SHOW:
|
|
- or go back to the newest paste.
| 1 | -- This script has been converted to FE by iPxter | |
| 2 | - | local Player=Players.LocalPlayer |
| 2 | + | |
| 3 | ||
| 4 | if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
| |
| 5 | local Player,Mouse,mouse,UserInputService,ContextActionService = owner | |
| 6 | do | |
| 7 | print("FE Compatibility code by Mokiros | Translated to FE by iPxter")
| |
| 8 | script.Parent = Player.Character | |
| 9 | ||
| 10 | --RemoteEvent for communicating | |
| 11 | local Event = Instance.new("RemoteEvent")
| |
| 12 | Event.Name = "UserInput_Event" | |
| 13 | ||
| 14 | --Fake event to make stuff like Mouse.KeyDown work | |
| 15 | local function fakeEvent() | |
| 16 | local t = {_fakeEvent=true,Connect=function(self,f)self.Function=f end}
| |
| 17 | t.connect = t.Connect | |
| 18 | return t | |
| 19 | end | |
| 20 | ||
| 21 | --Creating fake input objects with fake variables | |
| 22 | local m = {Target=nil,Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent()}
| |
| 23 | local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()}
| |
| 24 | local CAS = {Actions={},BindAction=function(self,name,fun,touch,...)
| |
| 25 | CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil
| |
| 26 | end} | |
| 27 | --Merged 2 functions into one by checking amount of arguments | |
| 28 | CAS.UnbindAction = CAS.BindAction | |
| 29 | ||
| 30 | --This function will trigger the events that have been :Connect()'ed | |
| 31 | local function te(self,ev,...) | |
| 32 | local t = m[ev] | |
| 33 | if t and t._fakeEvent and t.Function then | |
| 34 | t.Function(...) | |
| 35 | end | |
| 36 | end | |
| 37 | - | local lrs=game:service'RunService'.RenderStepped |
| 37 | + | m.TrigEvent = te |
| 38 | UIS.TrigEvent = te | |
| 39 | ||
| 40 | Event.OnServerEvent:Connect(function(plr,io) | |
| 41 | if plr~=Player then return end | |
| 42 | if io.isMouse then | |
| 43 | m.Target = io.Target | |
| 44 | m.Hit = io.Hit | |
| 45 | else | |
| 46 | local b = io.UserInputState == Enum.UserInputState.Begin | |
| 47 | if io.UserInputType == Enum.UserInputType.MouseButton1 then | |
| 48 | return m:TrigEvent(b and "Button1Down" or "Button1Up") | |
| 49 | end | |
| 50 | for _,t in pairs(CAS.Actions) do | |
| 51 | for _,k in pairs(t.Keys) do | |
| 52 | if k==io.KeyCode then | |
| 53 | t.Function(t.Name,io.UserInputState,io) | |
| 54 | end | |
| 55 | end | |
| 56 | end | |
| 57 | m:TrigEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower()) | |
| 58 | UIS:TrigEvent(b and "InputBegan" or "InputEnded",io,false) | |
| 59 | end | |
| 60 | end) | |
| 61 | Event.Parent = NLS([==[ | |
| 62 | local Player = game:GetService("Players").LocalPlayer
| |
| 63 | local Event = script:WaitForChild("UserInput_Event")
| |
| 64 | ||
| 65 | local UIS = game:GetService("UserInputService")
| |
| 66 | local input = function(io,a) | |
| 67 | if a then return end | |
| 68 | --Since InputObject is a client-side instance, we create and pass table instead | |
| 69 | Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState})
| |
| 70 | end | |
| 71 | UIS.InputBegan:Connect(input) | |
| 72 | UIS.InputEnded:Connect(input) | |
| 73 | ||
| 74 | local Mouse = Player:GetMouse() | |
| 75 | local h,t | |
| 76 | --Give the server mouse data 30 times every second, but only if the values changed | |
| 77 | --If player is not moving their mouse, client won't fire events | |
| 78 | while wait(1/30) do | |
| 79 | if h~=Mouse.Hit or t~=Mouse.Target then | |
| 80 | h,t=Mouse.Hit,Mouse.Target | |
| 81 | Event:FireServer({isMouse=true,Target=t,Hit=h})
| |
| 82 | end | |
| 83 | end]==],Player.Character) | |
| 84 | Mouse,mouse,UserInputService,ContextActionService = m,m,UIS,CAS | |
| 85 | end | |
| 86 | local Players=game:service'Players' | |
| 87 | local Player=owner | |
| 88 | local Char=Player.Character | |
| 89 | local parts={};
| |
| 90 | local skipvotes=0 | |
| 91 | local prefix='!' | |
| 92 | local Width,Height,Gen,Div,Cap=.1,.1,100,70,12 | |
| 93 | local animspd=.75 | |
| 94 | wait(.05) | |
| 95 | ||
| 96 | function rainb(hue) | |
| 97 | local section = hue % 1 * 3 | |
| 98 | local secondary = 0.5 * math.pi * (section % 1) | |
| 99 | if section < 1 then | |
| 100 | return Color3.new(1, 1 - math.cos(secondary), 1 - math.sin(secondary)) | |
| 101 | elseif section < 2 then | |
| 102 | return Color3.new(1 - math.sin(secondary), 1, 1 - math.cos(secondary)) | |
| 103 | else | |
| 104 | return Color3.new(1 - math.cos(secondary), 1 - math.sin(secondary), 1) | |
| 105 | end | |
| 106 | end | |
| 107 | ||
| 108 | pcall(function() | |
| 109 | Char.SaVisualizer:Destroy() | |
| 110 | Char.HumanoidRootPart.Sound:Destroy() | |
| 111 | end) | |
| 112 | ||
| 113 | script.Name = 'SaVisualizer' | |
| 114 | ||
| 115 | local Modl=Instance.new('Model', script)
| |
| 116 | local HumanoidRootPart=Char:WaitForChild'HumanoidRootPart' | |
| 117 | local fp=CFrame.new(0,6,0)*CFrame.Angles(-math.rad(5),0,0) | |
| 118 | local S=Instance.new('Sound',HumanoidRootPart)
| |
| 119 | S.Looped=true | |
| 120 | S.Volume=1 | |
| 121 | S.EmitterSize=40 | |
| 122 | ||
| 123 | --[[ | |
| 124 | local bl=Instance.new('Part')
| |
| 125 | bl.Anchored=true | |
| 126 | bl.Size=Vector3.new(Width,Height,.2) | |
| 127 | bl.Material='SmoothPlastic' | |
| 128 | bl.Color=Color3.new(1,1,1) | |
| 129 | bl.Transparency=0 | |
| 130 | bl.CanCollide=false | |
| 131 | bl.Anchored=true | |
| 132 | bl.CFrame=fp*CFrame.new(0,Height*3,0) | |
| 133 | local bm=Instance.new('SpecialMesh',bl)
| |
| 134 | bl.MeshType='Sphere' | |
| 135 | bl.Parent=nil | |
| 136 | --]] | |
| 137 | ||
| 138 | local Generated=false | |
| 139 | local first=true | |
| 140 | function AddParts(Number) | |
| 141 | local up=1 | |
| 142 | if first then | |
| 143 | up=0 | |
| 144 | first=false | |
| 145 | end | |
| 146 | local nparts=#parts | |
| 147 | Generated=false | |
| 148 | for i = 0,math.floor(tonumber(Number)) do | |
| 149 | local p=Instance.new('Part')
| |
| 150 | p.Anchored=true | |
| 151 | p.Size=Vector3.new(Width,Height,.2) | |
| 152 | p.Material='SmoothPlastic' | |
| 153 | p.Color=Color3.new(1,1,1) | |
| 154 | p.Transparency=0 | |
| 155 | p.CanCollide=false | |
| 156 | p.Anchored=true | |
| 157 | p.CFrame=fp*CFrame.new(0,Height*3,0) | |
| 158 | local bm=Instance.new('SpecialMesh',p)
| |
| 159 | bm.MeshId='rbxasset://fonts/rightarm.mesh' | |
| 160 | bm.TextureId='rbxassetid://215418209' | |
| 161 | p.Parent=Modl | |
| 162 | --warn(nparts+i) | |
| 163 | parts[(nparts+up)+i]=p | |
| 164 | game.ItemChanged:wait() | |
| 165 | end | |
| 166 | Generated=true | |
| 167 | end | |
| 168 | ||
| 169 | function RmvParts(Number) | |
| 170 | if Generated then | |
| 171 | local nparts=#parts | |
| 172 | warn(nparts) | |
| 173 | for i = 0, Number do | |
| 174 | local n=nparts-i | |
| 175 | local per=parts[n] | |
| 176 | parts[n]=nil | |
| 177 | per:Destroy() | |
| 178 | lrs:wait() | |
| 179 | end | |
| 180 | warn(#parts) | |
| 181 | end | |
| 182 | end | |
| 183 | ||
| 184 | function Sound(Id) | |
| 185 | skipvotes=0 | |
| 186 | S:Stop() | |
| 187 | S.SoundId='rbxassetid://'..Id | |
| 188 | S:Play() | |
| 189 | end | |
| 190 | --326631346 | |
| 191 | function OnChat(P, Message) | |
| 192 | m=Message:lower() | |
| 193 | if m:sub(0,#prefix+3)== prefix..'snd' and P==Player then | |
| 194 | local id=tonumber(m:sub(6)) | |
| 195 | print(id) | |
| 196 | local snd=Sound(id) | |
| 197 | elseif m:sub(0,#prefix+3)== prefix..'add' and P==Player then | |
| 198 | local num=tonumber(m:sub(6)) | |
| 199 | warn(num) | |
| 200 | AddParts(num) | |
| 201 | elseif m:sub(0,#prefix+3)== prefix..'rmv' and P==Player then | |
| 202 | local num=tonumber(m:sub(6)) | |
| 203 | warn(num) | |
| 204 | RmvParts(num) | |
| 205 | elseif m:sub(0,#prefix+3)== prefix..'spd' and P==Player then | |
| 206 | local num=tonumber(m:sub(6)) | |
| 207 | warn(num) | |
| 208 | animspd=num or .8 | |
| 209 | elseif m:sub(0,#prefix+4)== prefix..'stop' and P==Player then | |
| 210 | S:Pause() | |
| 211 | elseif m:sub(0,#prefix+6)== prefix..'replay' and P==Player then | |
| 212 | --S:Stop() | |
| 213 | S:Play() | |
| 214 | elseif m:sub(0,#prefix+4)== prefix..'play' and P==Player then | |
| 215 | S:Resume() | |
| 216 | elseif m:sub(0,#prefix+5)== prefix..'vskip' then | |
| 217 | skipvotes=skipvotes+1 | |
| 218 | if skipvotes>= math.floor(Players.NumPlayers/3) then | |
| 219 | skipvotes=0 | |
| 220 | S:Stop() | |
| 221 | end | |
| 222 | end | |
| 223 | end | |
| 224 | ||
| 225 | function Connect(P) | |
| 226 | P.Chatted:connect(function(Message) | |
| 227 | OnChat(P, Message) | |
| 228 | end) | |
| 229 | end | |
| 230 | ||
| 231 | function HandleParts(Plb_l,Clr,Spd) | |
| 232 | for index, Part in next, parts do | |
| 233 | local neg=-(Width*index)+(Width*(#parts/2)) | |
| 234 | Part.CFrame=Part.CFrame:lerp(CFrame.Angles(0,0,0)*fp*CFrame.new(neg,Height*5,0),.1) | |
| 235 | if Generated then | |
| 236 | Part.Anchored=true | |
| 237 | if index==0 then | |
| 238 | Part.Mesh.VertexColor=Part.Mesh.VertexColor:lerp(Vector3.new(Clr.r,Clr.g,Clr.b),.6) | |
| 239 | Part.Mesh.Scale=Part.Mesh.Scale:lerp(Vector3.new(Width+.1,.1+Plb_l,.01),Spd/3.5) | |
| 240 | elseif index ~= 0 then | |
| 241 | spawn(function() | |
| 242 | wait(((index/200)*1.1)) | |
| 243 | --Part.Mesh.VertexColor=parts[index-1].Mesh.VertexColor | |
| 244 | Part.Mesh.VertexColor=Part.Mesh.VertexColor:lerp(parts[index-1].Mesh.VertexColor,.6) | |
| 245 | end) | |
| 246 | Part.Mesh.Scale=Part.Mesh.Scale:lerp(Vector3.new(Width+.1,parts[index-1].Mesh.Scale.Y,.01),Spd) | |
| 247 | end | |
| 248 | end | |
| 249 | end | |
| 250 | end | |
| 251 | ||
| 252 | lrs:connect(function() | |
| 253 | local Color = rainb(tick()/20) | |
| 254 | local Var=S.PlaybackLoudness | |
| 255 | --local Spd = .15+((.15*100)/Var) | |
| 256 | --warn(Spd,(.85*100)/Var) | |
| 257 | --if Spd > .75 then | |
| 258 | -- Spd=.7 | |
| 259 | --end | |
| 260 | if not S.IsPlaying or S.SoundId=='rbxassetid://0' then | |
| 261 | local mul=200 | |
| 262 | Var=(mul-.1)+math.sin(tick()*2)*mul | |
| 263 | --print(Var) | |
| 264 | end | |
| 265 | HandleParts(Var/Div,Color,animspd) | |
| 266 | end) | |
| 267 | ||
| 268 | Players.PlayerAdded:connect(function(P) | |
| 269 | Connect(P) | |
| 270 | end) | |
| 271 | ||
| 272 | for Index, P in next, Players:GetPlayers() do | |
| 273 | Connect(P) | |
| 274 | end | |
| 275 | --485859421 | |
| 276 | AddParts(Gen) | |
| 277 | Sound(326087110)--265675215//337053183//244769293 |