Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --https://github.com/Mokiros/roblox-FE-compatibility
- if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
- local Player,game,owner = owner,game
- local RealPlayer = Player
- do
- print("FE Compatibility code V2 by Mokiros")
- local RealPlayer = RealPlayer
- script.Parent = RealPlayer.Character
- --Fake event to make stuff like Mouse.KeyDown work
- local Disconnect_Function = function(this)
- this[1].Functions[this[2]] = nil
- end
- local Disconnect_Metatable = {__index={disconnect=Disconnect_Function,Disconnect=Disconnect_Function}}
- local FakeEvent_Metatable = {__index={
- Connect = function(this,f)
- local i = tostring(math.random(0,10000))
- while this.Functions[i] do
- i = tostring(math.random(0,10000))
- end
- this.Functions[i] = f
- return setmetatable({this,i},Disconnect_Metatable)
- end
- }}
- FakeEvent_Metatable.__index.connect = FakeEvent_Metatable.__index.Connect
- local function fakeEvent()
- return setmetatable({Functions={}},FakeEvent_Metatable)
- end
- --Creating fake input objects with fake variables
- local FakeMouse = {Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent(),Button2Up=fakeEvent(),Button2Down=fakeEvent()}
- FakeMouse.keyUp = FakeMouse.KeyUp
- FakeMouse.keyDown = FakeMouse.KeyDown
- local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()}
- local CAS = {Actions={},BindAction=function(self,name,fun,touch,...)
- CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil
- end}
- --Merged 2 functions into one by checking amount of arguments
- CAS.UnbindAction = CAS.BindAction
- --This function will trigger the events that have been :Connect()'ed
- local function TriggerEvent(self,ev,...)
- for _,f in pairs(self[ev].Functions) do
- f(...)
- end
- end
- FakeMouse.TriggerEvent = TriggerEvent
- UIS.TriggerEvent = TriggerEvent
- --Client communication
- local Event = Instance.new("RemoteEvent")
- Event.Name = "UserInput_Event"
- Event.OnServerEvent:Connect(function(plr,io)
- if plr~=RealPlayer then return end
- FakeMouse.Target = io.Target
- FakeMouse.Hit = io.Hit
- if not io.isMouse then
- local b = io.UserInputState == Enum.UserInputState.Begin
- if io.UserInputType == Enum.UserInputType.MouseButton1 then
- return FakeMouse:TriggerEvent(b and "Button1Down" or "Button1Up")
- end
- if io.UserInputType == Enum.UserInputType.MouseButton2 then
- return FakeMouse:TriggerEvent(b and "Button2Down" or "Button2Up")
- end
- for _,t in pairs(CAS.Actions) do
- for _,k in pairs(t.Keys) do
- if k==io.KeyCode then
- t.Function(t.Name,io.UserInputState,io)
- end
- end
- end
- FakeMouse:TriggerEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower())
- UIS:TriggerEvent(b and "InputBegan" or "InputEnded",io,false)
- end
- end)
- Event.Parent = NLS([==[local Event = script:WaitForChild("UserInput_Event")
- local Mouse = owner:GetMouse()
- local UIS = game:GetService("UserInputService")
- local input = function(io,RobloxHandled)
- if RobloxHandled then return end
- --Since InputObject is a client-side instance, we create and pass table instead
- Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState,Hit=Mouse.Hit,Target=Mouse.Target})
- end
- UIS.InputBegan:Connect(input)
- UIS.InputEnded:Connect(input)
- local h,t
- --Give the server mouse data every second frame, but only if the values changed
- --If player is not moving their mouse, client won't fire events
- local HB = game:GetService("RunService").Heartbeat
- while true do
- if h~=Mouse.Hit or t~=Mouse.Target then
- h,t=Mouse.Hit,Mouse.Target
- Event:FireServer({isMouse=true,Target=t,Hit=h})
- end
- --Wait 2 frames
- for i=1,2 do
- HB:Wait()
- end
- end]==],script)
- ----Sandboxed game object that allows the usage of client-side methods and services
- --Real game object
- local RealGame = game
- --Metatable for fake service
- local FakeService_Metatable = {
- __index = function(self,k)
- local s = rawget(self,"_RealService")
- if s then
- return typeof(s[k])=="function"
- and function(_,...)return s[k](s,...)end or s[k]
- end
- end,
- __newindex = function(self,k,v)
- local s = rawget(self,"_RealService")
- if s then s[k]=v end
- end
- }
- local function FakeService(t,RealService)
- t._RealService = typeof(RealService)=="string" and RealGame:GetService(RealService) or RealService
- return setmetatable(t,FakeService_Metatable)
- end
- --Fake game object
- local FakeGame = {
- GetService = function(self,s)
- return rawget(self,s) or RealGame:GetService(s)
- end,
- Players = FakeService({
- LocalPlayer = FakeService({GetMouse=function(self)return FakeMouse end},Player)
- },"Players"),
- UserInputService = FakeService(UIS,"UserInputService"),
- ContextActionService = FakeService(CAS,"ContextActionService"),
- RunService = FakeService({
- _btrs = {},
- RenderStepped = RealGame:GetService("RunService").Heartbeat,
- BindToRenderStep = function(self,name,_,fun)
- self._btrs[name] = self.Heartbeat:Connect(fun)
- end,
- UnbindFromRenderStep = function(self,name)
- self._btrs[name]:Disconnect()
- end,
- },"RunService")
- }
- rawset(FakeGame.Players,"localPlayer",FakeGame.Players.LocalPlayer)
- FakeGame.service = FakeGame.GetService
- FakeService(FakeGame,game)
- --Changing owner to fake player object to support owner:GetMouse()
- game,owner = FakeGame,FakeGame.Players.LocalPlayer
- end
- --[[
- edited by mr steal yo bork with a sweet gui
- credits goes to the original creators
- --]]
- -- visualizer
- local Parts = {}
- local Parts2 = {}
- local Direction = 1
- local loudness = 0
- local TColor = BrickColor.new("Black")
- for i = 1, 100 do
- local p = Instance.new("Part", game.Players.LocalPlayer.Character.Torso)
- p.Size = Vector3.new(0.2, 0.2, 0.2)
- p.Anchored = true
- p.CanCollide = false
- p.Material = "Neon"
- p.Position = game.Players.LocalPlayer.Character.Torso.Position
- table.insert(Parts, p)
- end
- for i = 1, 100 do
- local p = Instance.new("Part", game.Players.LocalPlayer.Character.Torso)
- p.Size = Vector3.new(0.2, 0.2, 0.2)
- p.Anchored = true
- p.CanCollide = false
- p.Material = "Neon"
- p.Position = game.Players.LocalPlayer.Character.Torso.Position
- table.insert(Parts2, p)
- end
- local sound = Instance.new("Sound", game.Players.LocalPlayer.Character.Torso)
- sound.SoundId = "rbxassetid://574539049"
- sound.Volume = 1
- sound:Play()
- spawn(function()
- local SelectedPart = 0
- while true do
- if Direction == 1 then
- if SelectedPart < #Parts then
- SelectedPart = SelectedPart + Direction
- else
- Direction = -1
- TColor = BrickColor.Random()
- end
- elseif Direction == -1 then
- if SelectedPart > 1 then
- SelectedPart = SelectedPart + Direction
- else
- Direction = 1
- TColor = BrickColor.Random()
- end
- end
- local sel = Parts[SelectedPart]
- local sel2 = Parts2[SelectedPart]
- sel.BrickColor = BrickColor.Random()
- sel2.BrickColor = BrickColor.Random()
- loudness = sound.PlaybackLoudness / 500
- sel.Size = Vector3.new(loudness, loudness, 0.2)
- sel2.Size = Vector3.new(loudness, loudness, 0.2)
- wait()
- sel.BrickColor = TColor
- sel2.BrickColor = TColor
- end
- end)
- game:GetService("RunService").RenderStepped:connect(function()
- for i = 1, #Parts do
- if i == 1 then
- Parts[i].CFrame = Parts[i].CFrame:lerp(game.Players.LocalPlayer.Character.Torso.CFrame, 0.9)
- else
- Parts[i].CFrame = Parts[i].CFrame:lerp(Parts[i - 1].CFrame * CFrame.Angles(-loudness / 20, math.sin(-loudness / 50), 0) * CFrame.new(0, 0, 0.15), 0.8)
- end
- end
- for i = 1, #Parts2 do
- if i == 1 then
- Parts2[i].CFrame = Parts2[i].CFrame:lerp(game.Players.LocalPlayer.Character.Torso.CFrame, 0.9)
- else
- Parts2[i].CFrame = Parts2[i].CFrame:lerp(Parts2[i - 1].CFrame * CFrame.Angles(-loudness / 20, math.sin(loudness / 50), 0) * CFrame.new(0, 0, 0.15), 0.8)
- end
- end
- end)
- player = game.Players.LocalPlayer
- Parts = {}
- local sound = Instance.new("Sound",workspace)
- sound.SoundId = "http://www.roblox.com/asset?id=413625451"
- sound:Play()
- --local sound = workspace.Sound
- local Ball = Instance.new("Part",workspace)
- Ball.Size = Vector3.new(1.5,1.5,1.5)
- Ball.Shape = "Ball"
- Ball.Material = "Neon"
- Ball.Anchored = true
- Ball.CanCollide = false
- Ball.TopSurface = 10
- Ball.BottomSurface = 10
- Ball.FrontSurface = 10
- Ball.BackSurface = 10
- Ball.LeftSurface = 10
- Ball.RightSurface = 10
- Ball.CFrame = player.Character.HumanoidRootPart.CFrame * CFrame.new(0,5,0)
- for i=1,50 do
- local p = Instance.new("Part")
- local m = Instance.new("BlockMesh")
- m.Name = "Mesh"
- m.Scale = Vector3.new(.5,.5,1)
- p.Size = Vector3.new(.2,.2,.2)
- p.Material = "SmoothPlastic"
- p.Anchored = true
- p.CanCollide = false
- p.TopSurface = 10
- p.BottomSurface = 10
- p.FrontSurface = 10
- p.BackSurface = 10
- p.LeftSurface = 10
- p.RightSurface = 10
- p.BrickColor = BrickColor.new("Black")
- p.Parent = Ball
- m.Parent = p
- p.CFrame = Ball.CFrame
- table.insert(Parts,p)
- end
- local rotspd = .5
- game:GetService'RunService'.RenderStepped:connect(function()
- local circumference = .1*#Parts
- local answer = circumference/(math.pi*2)
- ---Ball.CFrame = Ball.CFrame:lerp(player.Character.HumanoidRootPart.CFrame * CFrame.new(0,5,0),.5)
- Ball.CFrame = Ball.CFrame:lerp(Ball.CFrame * CFrame.Angles(math.rad(rotspd),math.rad(rotspd),math.rad(rotspd)),.5)
- for i,v in pairs(Parts) do
- v.CFrame = v.CFrame:lerp(Ball.CFrame * CFrame.Angles(0, math.rad(i*(360/#Parts)), 0) * CFrame.new(0, 0, answer), .5)
- v.Mesh.Scale = v.Mesh.Scale:lerp(Vector3.new(.5,.5,1),.03)
- end
- end)
- spawn(function()
- local SelectedPart = 0
- while true do
- if SelectedPart < #Parts then
- SelectedPart = SelectedPart + 1
- else
- SelectedPart = 1
- end
- local sel = Parts[SelectedPart]
- sel.BrickColor = BrickColor.new("White")
- sel.Material = "Neon"
- if sound then
- sel.Mesh.Scale = sel.Mesh.Scale:lerp(Vector3.new(.5,.5,sound.PlaybackLoudness/60),.9)
- end
- wait(.01)
- sel.Material = "SmoothPlastic"
- sel.BrickColor = BrickColor.new("Black")
- end
- end)
Add Comment
Please, Sign In to add comment