SHOW:
|
|
- or go back to the newest paste.
| 1 | if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
| |
| 2 | local Player,Mouse,mouse,UserInputService,ContextActionService = owner | |
| 3 | do | |
| 4 | print("FE Compatibility code by Mokiros")
| |
| 5 | script.Parent = Player.Character | |
| 6 | ||
| 7 | --RemoteEvent for communicating | |
| 8 | local Event = Instance.new("RemoteEvent")
| |
| 9 | Event.Name = "UserInput_Event" | |
| 10 | ||
| 11 | --Fake event to make stuff like Mouse.KeyDown work | |
| 12 | local function fakeEvent() | |
| 13 | local t = {_fakeEvent=true,Connect=function(self,f)self.Function=f end}
| |
| 14 | t.connect = t.Connect | |
| 15 | return t | |
| 16 | end | |
| 17 | ||
| 18 | --Creating fake input objects with fake variables | |
| 19 | local m = {Target=nil,Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent()}
| |
| 20 | local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()}
| |
| 21 | local CAS = {Actions={},BindAction=function(self,name,fun,touch,...)
| |
| 22 | CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil
| |
| 23 | end} | |
| 24 | --Merged 2 functions into one by checking amount of arguments | |
| 25 | CAS.UnbindAction = CAS.BindAction | |
| 26 | ||
| 27 | --This function will trigger the events that have been :Connect()'ed | |
| 28 | local function te(self,ev,...) | |
| 29 | local t = m[ev] | |
| 30 | if t and t._fakeEvent and t.Function then | |
| 31 | t.Function(...) | |
| 32 | end | |
| 33 | end | |
| 34 | m.TrigEvent = te | |
| 35 | UIS.TrigEvent = te | |
| 36 | ||
| 37 | Event.OnServerEvent:Connect(function(plr,io) | |
| 38 | if plr~=Player then return end | |
| 39 | if io.isMouse then | |
| 40 | m.Target = io.Target | |
| 41 | m.Hit = io.Hit | |
| 42 | else | |
| 43 | local b = io.UserInputState == Enum.UserInputState.Begin | |
| 44 | if io.UserInputType == Enum.UserInputType.MouseButton1 then | |
| 45 | return m:TrigEvent(b and "Button1Down" or "Button1Up") | |
| 46 | end | |
| 47 | for _,t in pairs(CAS.Actions) do | |
| 48 | for _,k in pairs(t.Keys) do | |
| 49 | if k==io.KeyCode then | |
| 50 | t.Function(t.Name,io.UserInputState,io) | |
| 51 | end | |
| 52 | end | |
| 53 | end | |
| 54 | m:TrigEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower()) | |
| 55 | UIS:TrigEvent(b and "InputBegan" or "InputEnded",io,false) | |
| 56 | end | |
| 57 | end) | |
| 58 | Event.Parent = NLS([==[ | |
| 59 | local Player = game:GetService("Players").LocalPlayer
| |
| 60 | local Event = script:WaitForChild("UserInput_Event")
| |
| 61 | ||
| 62 | local UIS = game:GetService("UserInputService")
| |
| 63 | local input = function(io,a) | |
| 64 | if a then return end | |
| 65 | --Since InputObject is a client-side instance, we create and pass table instead | |
| 66 | Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState})
| |
| 67 | end | |
| 68 | UIS.InputBegan:Connect(input) | |
| 69 | UIS.InputEnded:Connect(input) | |
| 70 | ||
| 71 | local Mouse = Player:GetMouse() | |
| 72 | local h,t | |
| 73 | --Give the server mouse data 30 times every second, but only if the values changed | |
| 74 | --If player is not moving their mouse, client won't fire events | |
| 75 | while wait(1/30) do | |
| 76 | if h~=Mouse.Hit or t~=Mouse.Target then | |
| 77 | h,t=Mouse.Hit,Mouse.Target | |
| 78 | Event:FireServer({isMouse=true,Target=t,Hit=h})
| |
| 79 | end | |
| 80 | end]==],Player.Character) | |
| 81 | Mouse,mouse,UserInputService,ContextActionService = m,m,UIS,CAS | |
| 82 | end | |
| 83 | print([[ | |
| 84 | This is my attempt at making an actual working visulizer. | |
| 85 | Credit to Kyutatsuki for "helping" me make this. Really couldn't have done this myself. | |
| 86 | - Theamazingnater | |
| 87 | ||
| 88 | P.S. More visulizers coming your way! | |
| 89 | ||
| 90 | ||
| 91 | Controls: | |
| 92 | play/(id) | |
| 93 | stop | |
| 94 | antideath on | |
| 95 | antideath off | |
| 96 | loop on | |
| 97 | loop off | |
| 98 | ]]) | |
| 99 | ||
| 100 | wait(1/60) | |
| 101 | player = game.Players.LocalPlayer | |
| 102 | char = player.Character | |
| 103 | rs = game:GetService("RunService").RenderStepped
| |
| 104 | ||
| 105 | ||
| 106 | local Radio = Instance.new("Part",char)
| |
| 107 | Radio.CanCollide = false | |
| 108 | local RadioMesh = Instance.new("FileMesh",Radio)
| |
| 109 | RadioMesh.MeshId = "rbxassetid://151760030" | |
| 110 | RadioMesh.TextureId = "rbxassetid://151760072" | |
| 111 | RadioMesh.Scale = Vector3.new(0.7,0.7,0.7) | |
| 112 | local RadioWeld = Instance.new("Weld",Radio)
| |
| 113 | RadioWeld.Part0 = Radio | |
| 114 | RadioWeld.Part1 = char.Torso | |
| 115 | RadioWeld.C0 = CFrame.new(-0.0894899368, -0.236836433, 0.787712097, -0.867854834, 0.496817887, 0, 0.496817887, 0.867854834, 0, 0, 0, -1) | |
| 116 | local Sound = Instance.new("Sound",Radio)
| |
| 117 | Sound.Volume = 4 | |
| 118 | Sound.SoundId = "rbxassetid://" | |
| 119 | OriginalSize = Vector3.new(0.7,0.7,0.7) | |
| 120 | CanDie = true | |
| 121 | ||
| 122 | market = game:GetService("MarketplaceService")
| |
| 123 | ||
| 124 | local BODY = {}
| |
| 125 | LeftArm = char["Left Arm"] | |
| 126 | RightLeg = char["Right Leg"] | |
| 127 | LeftLeg = char["Left Leg"] | |
| 128 | for _, c in pairs(char:GetDescendants()) do | |
| 129 | if c:IsA("BasePart") and c.Name ~= "Handle" then
| |
| 130 | if c ~= char.HumanoidRootPart and c ~= char.Torso and c ~= char.Head and c ~= char["Right Arm"] and c ~= LeftArm and c ~= RightLeg and c ~= LeftLeg then | |
| 131 | c.CustomPhysicalProperties = PhysicalProperties.new(0, 0, 0, 0, 0) | |
| 132 | end | |
| 133 | table.insert(BODY,{c,c.Parent,c.Material,c.Color,c.Transparency})
| |
| 134 | elseif c:IsA("JointInstance") then
| |
| 135 | table.insert(BODY,{c,c.Parent,nil,nil,nil})
| |
| 136 | end | |
| 137 | end | |
| 138 | for e = 1, #BODY do | |
| 139 | if BODY[e] ~= nil then | |
| 140 | local STUFF = BODY[e] | |
| 141 | local PART = STUFF[1] | |
| 142 | local PARENT = STUFF[2] | |
| 143 | local MATERIAL = STUFF[3] | |
| 144 | local TRANSPARENCY = STUFF[5] | |
| 145 | if PART.ClassName == "Part" and PART ~= char.HumanoidRootPart then | |
| 146 | PART.Material = MATERIAL | |
| 147 | PART.Transparency = TRANSPARENCY | |
| 148 | end | |
| 149 | PART.AncestryChanged:Connect(function() | |
| 150 | PART.Parent = PARENT | |
| 151 | end) | |
| 152 | end | |
| 153 | end | |
| 154 | function refit() | |
| 155 | char.Parent = workspace | |
| 156 | for e = 1, #BODY do | |
| 157 | if BODY[e] ~= nil then | |
| 158 | local STUFF = BODY[e] | |
| 159 | local PART = STUFF[1] | |
| 160 | local PARENT = STUFF[2] | |
| 161 | local MATERIAL = STUFF[3] | |
| 162 | local TRANSPARENCY = STUFF[5] | |
| 163 | if PART.ClassName == "Part" and PART ~= char.HumanoidRootPart then | |
| 164 | PART.Material = MATERIAL | |
| 165 | PART.Transparency = TRANSPARENCY | |
| 166 | end | |
| 167 | if PART.Parent ~= PARENT then | |
| 168 | char:FindFirstChildOfClass("Humanoid"):remove()
| |
| 169 | PART.Parent = PARENT | |
| 170 | Humanoid = Instance.new("Humanoid",char)
| |
| 171 | end | |
| 172 | end | |
| 173 | end | |
| 174 | end | |
| 175 | char.Humanoid.Died:connect(function() | |
| 176 | if CanDie == false then | |
| 177 | refit() | |
| 178 | end | |
| 179 | end) | |
| 180 | ||
| 181 | player.Chatted:connect(function(msg) | |
| 182 | if msg:sub(1,5) == "play/" then | |
| 183 | Sound:Stop() | |
| 184 | Sound.SoundId = "rbxassetid://" .. msg:sub(6) | |
| 185 | Sound:Play() | |
| 186 | Music = market:GetProductInfo(msg:sub(6)) | |
| 187 | print("Now playing, " .. Music.Name)
| |
| 188 | end | |
| 189 | if msg == "stop" then | |
| 190 | Sound:Stop() | |
| 191 | print("Stopped the music/sound.")
| |
| 192 | end | |
| 193 | if msg == "antideath on" then | |
| 194 | CanDie = false | |
| 195 | print("Antideath has been activated!")
| |
| 196 | end | |
| 197 | if msg == "antideath off" then | |
| 198 | CanDie = true | |
| 199 | print("Oof! Antideath has been deactivated.")
| |
| 200 | end | |
| 201 | if msg == "loop on" then | |
| 202 | print("Looping on!")
| |
| 203 | Sound.Looped = true | |
| 204 | end | |
| 205 | if msg == "loop off" then | |
| 206 | print("Looping off!")
| |
| 207 | Sound.Looped = false | |
| 208 | end | |
| 209 | end) | |
| 210 | ||
| 211 | while rs:wait() do | |
| 212 | if CanDie == false then | |
| 213 | refit() | |
| 214 | end | |
| 215 | Sound.Parent = Radio | |
| 216 | RadioMesh.Scale = RadioMesh.Scale:lerp(Vector3.new(OriginalSize.X+Sound.PlaybackLoudness/4000*3.5,OriginalSize.Y+Sound.PlaybackLoudness/4000*3.5,OriginalSize.Z+Sound.PlaybackLoudness/4000*3.5),0.8) | |
| 217 | end |