SHOW:
|
|
- or go back to the newest paste.
1 | - | -- Visualizer made by fusionfriends, Enjoy :) |
1 | + | -- Visualizer made by TameDoNotClick, Enjoy :) |
2 | if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end | |
3 | local Player,Mouse,mouse,UserInputService,ContextActionService = owner | |
4 | do | |
5 | print("FE Compatibility code by Mokiros | Translated to FE by iPxter") | |
6 | script.Parent = Player.Character | |
7 | ||
8 | --RemoteEvent for communicating | |
9 | local Event = Instance.new("RemoteEvent") | |
10 | Event.Name = "UserInput_Event" | |
11 | ||
12 | --Fake event to make stuff like Mouse.KeyDown work | |
13 | local function fakeEvent() | |
14 | local t = {_fakeEvent=true,Connect=function(self,f)self.Function=f end} | |
15 | t.connect = t.Connect | |
16 | return t | |
17 | end | |
18 | ||
19 | --Creating fake input objects with fake variables | |
20 | local m = {Target=nil,Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent()} | |
21 | local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()} | |
22 | local CAS = {Actions={},BindAction=function(self,name,fun,touch,...) | |
23 | CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil | |
24 | end} | |
25 | --Merged 2 functions into one by checking amount of arguments | |
26 | CAS.UnbindAction = CAS.BindAction | |
27 | ||
28 | --This function will trigger the events that have been :Connect()'ed | |
29 | local function te(self,ev,...) | |
30 | local t = m[ev] | |
31 | if t and t._fakeEvent and t.Function then | |
32 | t.Function(...) | |
33 | end | |
34 | end | |
35 | m.TrigEvent = te | |
36 | UIS.TrigEvent = te | |
37 | ||
38 | Event.OnServerEvent:Connect(function(plr,io) | |
39 | if plr~=Player then return end | |
40 | if io.isMouse then | |
41 | m.Target = io.Target | |
42 | m.Hit = io.Hit | |
43 | else | |
44 | local b = io.UserInputState == Enum.UserInputState.Begin | |
45 | if io.UserInputType == Enum.UserInputType.MouseButton1 then | |
46 | return m:TrigEvent(b and "Button1Down" or "Button1Up") | |
47 | end | |
48 | for _,t in pairs(CAS.Actions) do | |
49 | for _,k in pairs(t.Keys) do | |
50 | if k==io.KeyCode then | |
51 | t.Function(t.Name,io.UserInputState,io) | |
52 | end | |
53 | end | |
54 | end | |
55 | m:TrigEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower()) | |
56 | UIS:TrigEvent(b and "InputBegan" or "InputEnded",io,false) | |
57 | end | |
58 | end) | |
59 | Event.Parent = NLS([==[ | |
60 | local Player = game:GetService("Players").LocalPlayer | |
61 | local Event = script:WaitForChild("UserInput_Event") | |
62 | ||
63 | local UIS = game:GetService("UserInputService") | |
64 | local input = function(io,a) | |
65 | if a then return end | |
66 | --Since InputObject is a client-side instance, we create and pass table instead | |
67 | Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState}) | |
68 | end | |
69 | UIS.InputBegan:Connect(input) | |
70 | UIS.InputEnded:Connect(input) | |
71 | ||
72 | local Mouse = Player:GetMouse() | |
73 | local h,t | |
74 | --Give the server mouse data 30 times every second, but only if the values changed | |
75 | --If player is not moving their mouse, client won't fire events | |
76 | while wait(1/30) do | |
77 | if h~=Mouse.Hit or t~=Mouse.Target then | |
78 | h,t=Mouse.Hit,Mouse.Target | |
79 | Event:FireServer({isMouse=true,Target=t,Hit=h}) | |
80 | end | |
81 | end]==],Player.Character) | |
82 | Mouse,mouse,UserInputService,ContextActionService = m,m,UIS,CAS | |
83 | end | |
84 | local Player = owner | |
85 | local TweenService = game:GetService("TweenService") | |
86 | local PlayerGui = Player.PlayerGui | |
87 | local Character = Player.Character | |
88 | local RootPart = Character.HumanoidRootPart | |
89 | ||
90 | local Part = Instance.new("Part",workspace) | |
91 | Part.Size = Vector3.new(2,2,2) | |
92 | Part.CanCollide = false | |
93 | Part.Name = "Visualizer" | |
94 | Part.Material = Enum.Material.SmoothPlastic | |
95 | Part.BrickColor = BrickColor.new("Black") | |
96 | Part.Anchored = true | |
97 | ||
98 | local Mesh = Instance.new("SpecialMesh",Part) | |
99 | Mesh.MeshId = "rbxassetid://1254392112" | |
100 | Mesh.Scale = Vector3.new(0.2,0.4,0.2) | |
101 | ||
102 | local Part2 = Instance.new("Part",workspace) | |
103 | local Part3 = Instance.new("Part",workspace) | |
104 | local Mesh2 = Instance.new("SpecialMesh",Part2) | |
105 | local Mesh3 = Instance.new("SpecialMesh",Part3) | |
106 | local Weld = Instance.new("Weld",Part2) | |
107 | local Weld2 = Instance.new("Weld",Part3) | |
108 | ||
109 | Part2.BrickColor = BrickColor.new("Really black") | |
110 | Part2.Material = Enum.Material.Neon | |
111 | Part2.Size = Vector3.new(2,1,2) | |
112 | Part2.CanCollide = false | |
113 | ||
114 | Part3.BrickColor = BrickColor.new("Really black") | |
115 | Part3.Material = Enum.Material.Neon | |
116 | Part3.Size = Vector3.new(2,1,2) | |
117 | Part3.CanCollide = false | |
118 | ||
119 | Mesh2.MeshId = "rbxassetid://2913878791" | |
120 | Mesh2.Scale = Vector3.new(0.1,0.1,0.05) | |
121 | ||
122 | Mesh3.MeshId = "rbxassetid://2913878791" | |
123 | Mesh3.Scale = Vector3.new(0.1,0.1,0.05) | |
124 | ||
125 | Weld.Part1 = Part | |
126 | Weld.Part0 = Part2 | |
127 | ||
128 | Weld2.Part1 = Part | |
129 | Weld2.Part0 = Part3 | |
130 | ||
131 | local Part4 = Instance.new("Part",workspace) | |
132 | Part4.Material = Enum.Material.Neon | |
133 | Part4.BrickColor = BrickColor.new("Really black") | |
134 | Part4.CanCollide = false | |
135 | ||
136 | local Mesh4 = Instance.new("SpecialMesh",Part4) | |
137 | Mesh4.MeshId = "rbxassetid://489415447" | |
138 | ||
139 | local Weld4 = Instance.new("Weld",Part) | |
140 | Weld4.Part1 = Part | |
141 | Weld4.Part0 = Part4 | |
142 | Weld4.C0 = CFrame.new(0,12,0) | |
143 | ||
144 | local Music = Instance.new("Sound",owner.Character.Torso) | |
145 | Music.Name = "Music" | |
146 | Music.Looped = true | |
147 | Music.Volume = 7 | |
148 | ||
149 | Player.Chatted:Connect(function(Message) | |
150 | if Message:sub(1,5)=="Play/" or "play/" then | |
151 | local Id = Message:sub(6,#Message) | |
152 | if tonumber(Id) then | |
153 | print(Id) | |
154 | Music.SoundId = ("rbxassetid://"..Id) | |
155 | Music:Play() | |
156 | end | |
157 | end | |
158 | end) | |
159 | ||
160 | local LoudnessEvent = Instance.new("RemoteEvent") | |
161 | LoudnessEvent.Name = "LoudnessEvent" | |
162 | LoudnessEvent.Parent = NLS([==[ | |
163 | local Music = owner.Character.Torso:WaitForChild("Music") | |
164 | local LoudnessEvent = script.LoudnessEvent | |
165 | game:GetService("RunService").Heartbeat:Connect(function() | |
166 | local loudness = Music.PlaybackLoudness | |
167 | LoudnessEvent:FireServer(loudness) | |
168 | end) | |
169 | ]==],owner.PlayerGui) | |
170 | LoudnessEvent.OnServerEvent:Connect(function(player,loudness) | |
171 | Loudness = loudness | |
172 | while true do | |
173 | wait() | |
174 | Part.CFrame = Part.CFrame:Lerp(CFrame.new(RootPart.Position.X,RootPart.Position.Y+10,RootPart.Position.Z),.6) | |
175 | Weld.C0 = Weld.C0*CFrame.Angles(0,math.rad(Loudness/50),0) | |
176 | Weld2.C0 = Weld2.C0*CFrame.Angles(math.rad(-Loudness/50),0,0) | |
177 | Mesh2.Scale = Vector3.new(Loudness/5000+.1,Loudness/5000+.1,Mesh2.Scale.Z) | |
178 | Mesh3.Scale = Vector3.new(Loudness/5000+.1,Loudness/5000+.1,Mesh3.Scale.Z) | |
179 | Part2.BrickColor = BrickColor.new(Loudness/300,0,0) | |
180 | Part.BrickColor = BrickColor.new(Loudness/300,0,0) | |
181 | Part3.BrickColor = BrickColor.new(Loudness/300,0,0) | |
182 | Part4.BrickColor = BrickColor.new(Loudness/300,0,0) | |
183 | Weld4.C0 = Weld4.C0*CFrame.Angles(0,math.rad(Loudness/50),0) | |
184 | Mesh4.Scale = Vector3.new(Loudness/100+5,3,Loudness/100+5) | |
185 | end | |
186 | end) |