View difference between Paste ID: nWNQaSQM and QPg20D5y
SHOW: | | - or go back to the newest paste.
1
--https://github.com/Mokiros/roblox-FE-compatibility
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
local RealPlayer = Player
5
do print("FE Compatibility code by Mokiros")local a=RealPlayer;script.Parent=a.Character;local b=Instance.new("RemoteEvent")b.Name="UserInput_Event"local function c()local d={_fakeEvent=true,Functions={},Connect=function(self,e)table.insert(self.Functions,e)end}d.connect=d.Connect;return d end;local f={Target=nil,Hit=CFrame.new(),KeyUp=c(),KeyDown=c(),Button1Up=c(),Button1Down=c(),Button2Up=c(),Button2Down=c()}local g={InputBegan=c(),InputEnded=c()}local CAS={Actions={},BindAction=function(self,h,i,j,...)CAS.Actions[h]=i and{Name=h,Function=i,Keys={...}}or nil end}CAS.UnbindAction=CAS.BindAction;local function k(self,l,...)local d=f[l]if d and d._fakeEvent then for m,e in pairs(d.Functions)do e(...)end end end;f.TrigEvent=k;g.TrigEvent=k;b.OnServerEvent:Connect(function(n,o)if n~=a then return end;f.Target=o.Target;f.Hit=o.Hit;if not o.isMouse then local p=o.UserInputState==Enum.UserInputState.Begin;if o.UserInputType==Enum.UserInputType.MouseButton1 then return f:TrigEvent(p and"Button1Down"or"Button1Up")end;if o.UserInputType==Enum.UserInputType.MouseButton2 then return f:TrigEvent(p and"Button2Down"or"Button2Up")end;for m,d in pairs(CAS.Actions)do for m,q in pairs(d.Keys)do if q==o.KeyCode then d.Function(d.Name,o.UserInputState,o)end end end;f:TrigEvent(p and"KeyDown"or"KeyUp",o.KeyCode.Name:lower())g:TrigEvent(p and"InputBegan"or"InputEnded",o,false)end end)b.Parent=NLS([==[local a=game:GetService("Players").LocalPlayer;local b=script:WaitForChild("UserInput_Event")local c=a:GetMouse()local d=game:GetService("UserInputService")local e=function(f,g)if g then return end;b:FireServer({KeyCode=f.KeyCode,UserInputType=f.UserInputType,UserInputState=f.UserInputState,Hit=c.Hit,Target=c.Target})end;d.InputBegan:Connect(e)d.InputEnded:Connect(e)local h,i;while wait(1/30)do if h~=c.Hit or i~=c.Target then h,i=c.Hit,c.Target;b:FireServer({isMouse=true,Target=i,Hit=h})end end]==],Player.Character)local r=game;local s={__index=function(self,q)local t=rawget(self,"_RealService")if t then return typeof(t[q])=="function"and function(m,...)return t[q](t,...)end or t[q]end end,__newindex=function(self,q,u)local t=rawget(self,"_RealService")if t then t[q]=u end end}local function v(d,w)d._RealService=typeof(w)=="string"and r:GetService(w)or w;return setmetatable(d,s)end;local x={GetService=function(self,t)return rawget(self,t)or r:GetService(t)end,Players=v({LocalPlayer=v({GetMouse=function(self)return f end},Player)},"Players"),UserInputService=v(g,"UserInputService"),ContextActionService=v(CAS,"ContextActionService"),RunService=v({_btrs={},RenderStepped=r:GetService("RunService").Heartbeat,BindToRenderStep=function(self,h,m,i)self._btrs[h]=self.Heartbeat:Connect(i)end,UnbindFromRenderStep=function(self,h)self._btrs[h]:Disconnect()end},"RunService")}rawset(x.Players,"localPlayer",x.Players.LocalPlayer)x.service=x.GetService;v(x,game)game,owner=x,x.Players.LocalPlayer end
6
wait(.5)
7
script.Parent = nil
8
Settings = {
9
	NumParts =20;
10
	Spacing = 0;
11
	Height = 5;
12
	SizeZ = .1;
13
}
14
MainParts = {}
15
16
for i=1,Settings.NumParts do
17
	local Part = Instance.new("Part")
18
	Part.Anchored = true
19
	Part.Material='Neon'
20
	Part.Size = Vector3.new(1,.1,1)
21
	Part.CanCollide = false
22
	Part.TopSurface = 10
23
	Part.BottomSurface = 10
24
	Part.FrontSurface = 10
25
	Part.BackSurface = 10
26
	Part.LeftSurface = 10
27
	Part.RightSurface = 10
28
	local PM = Instance.new("BlockMesh",Part)
29
	PM.Name = "Mesh"
30
	PM.Scale = Part.Size
31
	if MainParts[1] then
32
		Part.Parent = MainParts[1]
33
		Part.CFrame = game.Players.LocalPlayer.Character.Head.CFrame
34
	else
35
		Part.Parent = game.Players.LocalPlayer.Character
36
		Part.CFrame = game.Players.LocalPlayer.Character.Head.CFrame
37
	end
38
	table.insert(MainParts,#MainParts+1,Part)
39
end
40
    insertsound = Instance.new("Sound")
41
	insertsound.Looped = true
42
	insertsound.Name = "AYEE"
43
	insertsound.MaxDistance = 100
44
	insertsound.EmitterSize = math.huge
45
	insertsound.Volume = 5
46
	insertsound.Pitch = 1
47
	--insertsound.SoundId = "http://www.roblox.com/asset?id=574539049"
48
	insertsound.SoundId = "http://www.roblox.com/asset?id=570556587"
49
	insertsound.Parent = game.Players.LocalPlayer.Character
50
	insertsound:Play()
51
game:GetService'RunService'.RenderStepped:connect(function()
52
	local function UpdateColor()
53
		MainParts[1].Changed:connect(function()
54
		end)
55
		for i = 2,#MainParts do
56
			MainParts[i].BrickColor = MainParts[i-1].BrickColor
57
			wait()
58
		end
59
	end	
60
	pcall(function()
61
		MainParts[1].Mesh.Scale = MainParts[1].Mesh.Scale:lerp(Vector3.new(1,insertsound.PlaybackLoudness/10,Settings.SizeZ),.5)
62
		MainParts[1].CFrame = MainParts[1].CFrame:lerp(game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame * CFrame.new((#MainParts/2-1) + (#MainParts*Settings.Spacing/2),Settings.Height,2),.9)
63
		if insertsound.PlaybackLoudness >= 350 then
64
			MainParts[1].BrickColor = BrickColor.Random()
65
			UpdateColor()
66
		end
67
		for i = 2,#MainParts do
68
			local Size = (MainParts[i-1]).Mesh.Scale.Y
69
			MainParts[i].Mesh.Scale = MainParts[i].Mesh.Scale:lerp(Vector3.new(1,Size,Settings.SizeZ),.9)
70
			local Offset = -(1 + Settings.Spacing)
71
			MainParts[i].CFrame = MainParts[i].CFrame:lerp((MainParts[i-1].CFrame * CFrame.new(Offset,0,0)),.8)
72
		end
73
	end)
74
end)
75
76
77
game.Players.LocalPlayer.Chatted:connect(function(msg)
78
	print(msg)
79
	if msg:lower():sub(1,#'add') == 'add' then
80
		local function AddParts()
81
			for i=1,tonumber(msg:sub(#'add '+1)) do
82
				local Part = Instance.new("Part")
83
				Part.Anchored = true
84
				Part.Material='Neon'
85
				Part.Size = Vector3.new(1,.1,1)
86
				Part.CanCollide = false
87
				Part.TopSurface = 10
88
				Part.BottomSurface = 10
89
				Part.FrontSurface = 10
90
				Part.BackSurface = 10
91
				Part.LeftSurface = 10
92
				Part.RightSurface = 10
93
				Part.Parent = MainParts[1]
94
				Part.CFrame = MainParts[#MainParts].CFrame
95
				local PM = Instance.new("BlockMesh",Part)
96
				PM.Name = "Mesh"
97
				PM.Scale = Part.Size
98
				table.insert(MainParts,#MainParts+1,Part)
99
				wait()
100
			end
101
			print(#MainParts)
102
		end
103
		AddParts()
104
	end
105
	if msg:lower():sub(1,#'remove') == 'remove' then
106
		for i=1,tonumber(msg:sub(#'remove '+1)) do
107
			local Part = MainParts[#MainParts]
108
			Part:Remove()
109
			table.remove(MainParts,#MainParts)
110
			wait()
111
		end
112
		print(#MainParts)
113
	end
114
	if msg:lower():sub(1,#'total') == 'total' then
115
		print(#MainParts)
116
	end
117
	if msg:lower():sub(1,#'play') == 'play' then
118
		insertsound.SoundId = "http://www.roblox.com/asset?id="..tonumber(msg:sub(#'play '+1))
119
	end
120
end)