View difference between Paste ID: nzPiZ5ss and h6YKhvDr
SHOW: | | - or go back to the newest paste.
1
--Converted with ttyyuu12345's model to script plugin v4
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,game,owner = owner,game
4
local RealPlayer = Player
5
do
6
	print("FE Compatibility code by Mokiros")
7
	local rp = RealPlayer
8
	script.Parent = rp.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,Functions={},Connect=function(self,f)table.insert(self.Functions,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(),Button2Up=fakeEvent(),Button2Down=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 then
34
			for _,f in pairs(t.Functions) do
35
				f(...)
36
			end
37
		end
38
	end
39
	m.TrigEvent = te
40
	UIS.TrigEvent = te
41
42
	Event.OnServerEvent:Connect(function(plr,io)
43
	    if plr~=rp then return end
44
		m.Target = io.Target
45
		m.Hit = io.Hit
46
		if not io.isMouse then
47
			local b = io.UserInputState == Enum.UserInputState.Begin
48
			if io.UserInputType == Enum.UserInputType.MouseButton1 then
49
				return m:TrigEvent(b and "Button1Down" or "Button1Up")
50
			end
51
			if io.UserInputType == Enum.UserInputType.MouseButton2 then
52
				return m:TrigEvent(b and "Button2Down" or "Button2Up")
53
			end
54
			for _,t in pairs(CAS.Actions) do
55
				for _,k in pairs(t.Keys) do
56
					if k==io.KeyCode then
57
						t.Function(t.Name,io.UserInputState,io)
58
					end
59
				end
60
			end
61
			m:TrigEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower())
62
			UIS:TrigEvent(b and "InputBegan" or "InputEnded",io,false)
63
	    end
64
	end)
65
	Event.Parent = NLS([==[
66
	local Player = game:GetService("Players").LocalPlayer
67
	local Event = script:WaitForChild("UserInput_Event")
68
	local Mouse = Player:GetMouse()
69
	local UIS = game:GetService("UserInputService")
70
	local input = function(io,a)
71
		if a then return end
72
		--Since InputObject is a client-side instance, we create and pass table instead
73
		Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState,Hit=Mouse.Hit,Target=Mouse.Target})
74
	end
75
	UIS.InputBegan:Connect(input)
76
	UIS.InputEnded:Connect(input)
77
	local h,t
78
	--Give the server mouse data 30 times every second, but only if the values changed
79
	--If player is not moving their mouse, client won't fire events
80
	while wait(1/30) do
81
		if h~=Mouse.Hit or t~=Mouse.Target then
82
			h,t=Mouse.Hit,Mouse.Target
83
			Event:FireServer({isMouse=true,Target=t,Hit=h})
84
		end
85
	end]==],Player.Character)
86
87
	----Sandboxed game object that allows the usage of client-side methods and services
88
	--Real game object
89
	local _rg = game
90
91
	--Metatable for fake service
92
	local fsmt = {
93
		__index = function(self,k)
94
			local s = rawget(self,"_RealService")
95
			if s then
96
				return typeof(s[k])=="function"
97
				and function(_,...)return s[k](s,...)end or s[k]
98
			end
99
		end,
100
		__newindex = function(self,k,v)
101
			local s = rawget(self,"_RealService")
102
			if s then s[k]=v end
103
		end
104
	}
105
	local function FakeService(t,RealService)
106
		t._RealService = typeof(RealService)=="string" and _rg:GetService(RealService) or RealService
107
		return setmetatable(t,fsmt)
108
	end
109
110
	--Fake game object
111
	local g = {
112
		GetService = function(self,s)
113
			return rawget(self,s) or _rg:GetService(s)
114
		end,
115
		Players = FakeService({
116
			LocalPlayer = FakeService({GetMouse=function(self)return m end},Player)
117
		},"Players"),
118
		UserInputService = FakeService(UIS,"UserInputService"),
119
		ContextActionService = FakeService(CAS,"ContextActionService"),
120
		RunService = FakeService({
121
			_btrs = {},
122
			RenderStepped = _rg:GetService("RunService").Heartbeat,
123
			BindToRenderStep = function(self,name,_,fun)
124
				self._btrs[name] = self.Heartbeat:Connect(fun)
125
			end,
126
			UnbindFromRenderStep = function(self,name)
127
				self._btrs[name]:Disconnect()
128
			end,
129-
Sound8.SoundId = "http://www.roblox.com/asset/?id=142761485"
129+
		},"RunService")
130-
Sound8.Volume = 0.69999998807907
130+
	}
131
	rawset(g.Players,"localPlayer",g.Players.LocalPlayer)
132
	g.service = g.GetService
133
	FakeService(g,game)
134
	--Changing owner to fake player object to support owner:GetMouse()
135
	game,owner = g,g.Players.LocalPlayer
136
end
137
138
function sandbox(var,func)
139
	local env = getfenv(func)
140
	local newenv = setmetatable({},{
141
		__index = function(self,k)
142
			if k=="script" then
143
				return var
144
			else
145
				return env[k]
146
			end
147
		end,
148
	})
149
	setfenv(func,newenv)
150
	return func
151
end
152
cors = {}
153
mas = Instance.new("Model",game:GetService("Lighting"))
154
Tool0 = Instance.new("Tool")
155
LocalScript1 = Instance.new("LocalScript")
156
Part2 = Instance.new("Part")
157
BlockMesh3 = Instance.new("BlockMesh")
158
Part4 = Instance.new("Part")
159
BlockMesh5 = Instance.new("BlockMesh")
160
Part6 = Instance.new("Part")
161
SpecialMesh7 = Instance.new("SpecialMesh")
162
Sound8 = Instance.new("Sound")
163
Tool0.Name = "Leek"
164
Tool0.Parent = mas
165
Tool0.GripForward = Vector3.new(-0, -0, 1)
166
Tool0.GripRight = Vector3.new(-1, 0, 0)
167
Tool0.ToolTip = "Equip to start the party!"
168
Tool0.CanBeDropped = false
169
LocalScript1.Name = "LeekScript"
170
LocalScript1.Parent = Tool0
171
table.insert(cors,sandbox(LocalScript1,function()
172
local originalface=nil
173
local user=nil
174
175
Spawn(function()
176
	local prev 
177
	local parts = script.Parent:GetChildren() 
178
	for i = 1,#parts do 
179
		if (parts[i].className == "Part") then 
180
			if (prev ~= nil)then 
181
				local weld = Instance.new("Weld") 
182
				weld.Part0 = prev 
183
				weld.Part1 = parts[i] 
184
				weld.C0 = prev.CFrame:inverse() 
185
				weld.C1 = parts[i].CFrame:inverse() 
186
				weld.Parent = prev 
187
			end 
188
			prev = parts[i] 
189
			prev.Anchored = false
190
		end 
191
	end
192
end)
193
194
function onEquipped(mouse)
195
		print'start spin'
196
		down=true
197
		script.Parent.Handle.LeekSpin:Play()
198
		user=script.Parent.Parent
199
		originalface=script.Parent.Parent:WaitForChild("Head").face.Texture
200
		script.Parent.Parent:WaitForChild("Head").face.Texture="http://www.roblox.com/asset/?id=141452377"
201
        while down do
202
	       script.Parent.Grip=script.Parent.Grip*CFrame.Angles(0,0,0.2)
203
		   wait()
204
        end
205
end
206
207
function onUnequipped(mouse)
208
	down=false 
209
	user:WaitForChild("Head").face.Texture=originalface
210
	script.Parent.Handle.LeekSpin:Stop()
211
	print'stop spin'
212
end
213
214
script.Parent.Equipped:connect(onEquipped)
215
script.Parent.Unequipped:connect(onUnequipped)
216
end))
217
Part2.Parent = Tool0
218
Part2.BrickColor = BrickColor.new("Camo")
219
Part2.Rotation = Vector3.new(-165, 0, 180)
220
Part2.CanCollide = false
221
Part2.FormFactor = Enum.FormFactor.Custom
222
Part2.Size = Vector3.new(0.200000003, 1, 0.400000006)
223
Part2.CFrame = CFrame.new(13.2999926, 1.94176316, 13.0068178, -0.999999106, -1.96739265e-07, 1.70943835e-07, 5.28843771e-07, 0.965925574, 0.258818656, -8.13116685e-09, 0.258818835, -0.965924859)
224
Part2.TopSurface = Enum.SurfaceType.Smooth
225
Part2.Color = Color3.new(0.227451, 0.490196, 0.0823529)
226
Part2.Position = Vector3.new(13.2999926, 1.94176316, 13.0068178)
227
Part2.Orientation = Vector3.new(-15, 180, 0)
228
Part2.Color = Color3.new(0.227451, 0.490196, 0.0823529)
229
BlockMesh3.Parent = Part2
230
BlockMesh3.Scale = Vector3.new(0.5, 1, 0.5)
231
BlockMesh3.Scale = Vector3.new(0.5, 1, 0.5)
232
Part4.Parent = Tool0
233
Part4.BrickColor = BrickColor.new("Camo")
234
Part4.Rotation = Vector3.new(165, 0, 180)
235
Part4.CanCollide = false
236
Part4.FormFactor = Enum.FormFactor.Custom
237
Part4.Size = Vector3.new(0.200000003, 1, 0.400000006)
238
Part4.CFrame = CFrame.new(13.2999935, 1.94176269, 12.7931881, -0.999999046, -1.89076246e-07, -5.81593014e-08, 4.43757216e-07, 0.965925574, -0.258818597, -3.04669925e-08, -0.258818746, -0.965924978)
239
Part4.TopSurface = Enum.SurfaceType.Smooth
240
Part4.Color = Color3.new(0.227451, 0.490196, 0.0823529)
241
Part4.Position = Vector3.new(13.2999935, 1.94176269, 12.7931881)
242
Part4.Orientation = Vector3.new(15, -180, 0)
243
Part4.Color = Color3.new(0.227451, 0.490196, 0.0823529)
244
BlockMesh5.Parent = Part4
245
BlockMesh5.Scale = Vector3.new(0.5, 1, 0.5)
246
BlockMesh5.Scale = Vector3.new(0.5, 1, 0.5)
247
Part6.Name = "Handle"
248
Part6.Parent = Tool0
249
Part6.BrickColor = BrickColor.new("Institutional white")
250
Part6.Rotation = Vector3.new(69.9700012, 89.9300003, -12.4399996)
251
Part6.RotVelocity = Vector3.new(1, 1, 1)
252
Part6.CanCollide = false
253
Part6.FormFactor = Enum.FormFactor.Custom
254
Part6.Size = Vector3.new(0.200000003, 1.79999995, 0.200000003)
255
Part6.CFrame = CFrame.new(13.2999935, 0.889999628, 12.9000025, 6.36468656e-08, 1.40425129e-08, 0.999999285, 3.72529279e-08, 0.999999523, -6.17590786e-07, -0.999999285, -1.26659813e-07, 2.25185218e-07)
256
Part6.TopSurface = Enum.SurfaceType.Smooth
257
Part6.Color = Color3.new(0.972549, 0.972549, 0.972549)
258
Part6.Position = Vector3.new(13.2999935, 0.889999628, 12.9000025)
259
Part6.Orientation = Vector3.new(0, 90, 0)
260
Part6.Color = Color3.new(0.972549, 0.972549, 0.972549)
261
SpecialMesh7.Parent = Part6
262
Sound8.Name = "LeekSpin"
263
Sound8.Parent = Part6
264
Sound8.SoundId = "http://www.roblox.com/asset/?id=284819869"
265
Sound8.Volume = 2
266
Sound8.Looped = true
267
for i,v in pairs(mas:GetChildren()) do
268
	v.Parent = game:GetService("Players").LocalPlayer.Backpack
269
	pcall(function() v:MakeJoints() end)
270
end
271
mas:Destroy()
272
for i,v in pairs(cors) do
273
	spawn(function()
274
		pcall(v)
275
	end)
276
end