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 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 | --[[ | |
7 | Watch | |
8 | Zomg a watch. | |
9 | --]] | |
10 | ||
11 | ModelName = "Watch" | |
12 | Player = game:GetService("Players").LocalPlayer | |
13 | Char = Player.Character | |
14 | - | animate = Char:findFirstChild("Animate") |
14 | + | |
15 | - | if animate then |
15 | + | |
16 | - | animate:Destroy() |
16 | + | |
17 | CanUse = true | |
18 | WatchColor = BrickColor.new("Really black") | |
19 | FaceColor = BrickColor.new("Really black") | |
20 | FaceBackColor = BrickColor.new("Really black") | |
21 | CenterHandColor = BrickColor.new("Really black") | |
22 | NotchColor1 = BrickColor.new("Bright green") | |
23 | NotchColor2 = BrickColor.new("Bright green") | |
24 | HourHandColor = BrickColor.new("Really black") | |
25 | MinuteHandColor = BrickColor.new("Really black") | |
26 | SecondHandColor = BrickColor.new("Really red") | |
27 | ||
28 | ||
29 | ||
30 | function CheckPlayer() | |
31 | if Player.Character == nil then return false end | |
32 | if Player.Character:FindFirstChild("Torso") == nil or Player.Character:FindFirstChild("Right Arm") == nil or Player.Character:FindFirstChild("Humanoid") == nil then return false end | |
33 | if Player.Character.Humanoid.Health <= 0 then return false end | |
34 | return true | |
35 | end | |
36 | ||
37 | ||
38 | ||
39 | ||
40 | function Time() | |
41 | local Hours = math.floor((tick() / 3600) % 24) | |
42 | local Minutes = math.floor((tick() % 3600) / 60) | |
43 | local Seconds = math.floor(tick() % 60) | |
44 | local Section = "" | |
45 | if Hours == 24 or Hours < 12 then | |
46 | Section = "AM" | |
47 | else | |
48 | Section = "PM" | |
49 | end | |
50 | if Hours > 12 then | |
51 | Hours = Hours - 12 | |
52 | end | |
53 | if Minutes <= 9 then | |
54 | Minutes = "0" ..tostring(Minutes) | |
55 | end | |
56 | if Seconds <= 9 then | |
57 | Seconds = "0" ..tostring(Seconds) | |
58 | end | |
59 | return Hours, Minutes, Seconds, Section | |
60 | end | |
61 | ||
62 | ||
63 | function CreateParts(Parent, Format) | |
64 | if Parent == nil then return end | |
65 | local Parts = Instance.new("Model") | |
66 | Parts.Name = ModelName | |
67 | if Format == 1 then | |
68 | Parts.Name = Parts.Name.. " (Holstered)" | |
69 | end | |
70 | Parts.Parent = Player.Character | |
71 | ||
72 | local MasterPart1 = Instance.new("Part") | |
73 | MasterPart1.Material = "Neon" | |
74 | MasterPart1.Name = "Handle" | |
75 | MasterPart1.FormFactor = "Custom" | |
76 | MasterPart1.Size = Vector3.new(1.1, 0.2, 1.1) | |
77 | MasterPart1.BrickColor = WatchColor | |
78 | MasterPart1.TopSurface = 0 | |
79 | MasterPart1.BottomSurface = 0 | |
80 | MasterPart1.Parent = Parts | |
81 | Instance.new("BlockMesh", MasterPart1) | |
82 | local Weld = Instance.new("Weld", MasterPart1) | |
83 | Weld.Part0 = Weld.Parent | |
84 | Weld.Part1 = Player.Character:FindFirstChild("Right Arm") | |
85 | Weld.C0 = CFrame.new(0, 0.7, 0) | |
86 | ||
87 | local MasterPart2 = Instance.new("Part") | |
88 | MasterPart2.Material = "Neon" | |
89 | MasterPart2.Name = "Watch" | |
90 | MasterPart2.FormFactor = "Custom" | |
91 | MasterPart2.Size = Vector3.new(0.5, 0.21, 0.5) | |
92 | MasterPart2.BrickColor = WatchColor | |
93 | MasterPart2.TopSurface = 0 | |
94 | MasterPart2.BottomSurface = 0 | |
95 | MasterPart2.Parent = Parts | |
96 | Instance.new("CylinderMesh", MasterPart2) | |
97 | local Weld = Instance.new("Weld", MasterPart2) | |
98 | Weld.Part0 = Weld.Parent | |
99 | Weld.Part1 = MasterPart1 | |
100 | Weld.C0 = CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(90), 0) * CFrame.new(-0.5, 0, 0) | |
101 | ||
102 | for i = 0, 360, 15 do | |
103 | local Part = Instance.new("Part") | |
104 | Part.Material = "Neon" | |
105 | Part.Name = "Face Rim" | |
106 | Part.FormFactor = "Custom" | |
107 | Part.Size = Vector3.new(0.2, 0.2, 0.2) | |
108 | Part.BrickColor = WatchColor | |
109 | Part.TopSurface = 0 | |
110 | Part.BottomSurface = 0 | |
111 | Part.Parent = Parts | |
112 | Instance.new("BlockMesh", Part).Scale = Vector3.new(0.065 / 0.2, 0.03 / 0.2, 0.05 / 0.2) | |
113 | local Weld = Instance.new("Weld", Part) | |
114 | Weld.Part0 = Weld.Parent | |
115 | Weld.Part1 = MasterPart2 | |
116 | Weld.C0 = CFrame.new(0, 0.12, 0.224) * CFrame.fromEulerAnglesXYZ(0, math.rad(i), 0) | |
117 | end | |
118 | ||
119 | local Part = Instance.new("Part") | |
120 | Part.Material = "Neon" | |
121 | Part.Name = "Face" | |
122 | Part.FormFactor = "Custom" | |
123 | Part.Size = Vector3.new(0.4, 0.2, 0.4) | |
124 | Part.BrickColor = FaceColor | |
125 | Part.Transparency = 0.8 | |
126 | Part.TopSurface = 0 | |
127 | Part.BottomSurface = 0 | |
128 | Part.Parent = Parts | |
129 | Instance.new("CylinderMesh", Part).Scale = Vector3.new(1, 0.06 / 0.2, 1) | |
130 | local Weld = Instance.new("Weld", Part) | |
131 | Weld.Part0 = Weld.Parent | |
132 | Weld.Part1 = MasterPart2 | |
133 | Weld.C0 = CFrame.new(0, 0.1, 0) | |
134 | ||
135 | local Part = Instance.new("Part") | |
136 | Part.Material = "Neon" | |
137 | Part.Name = "Face Back" | |
138 | Part.FormFactor = "Custom" | |
139 | Part.Size = Vector3.new(0.4, 0.2, 0.4) | |
140 | Part.BrickColor = FaceBackColor | |
141 | Part.TopSurface = 0 | |
142 | Part.BottomSurface = 0 | |
143 | Part.Parent = Parts | |
144 | Instance.new("CylinderMesh", Part).Scale = Vector3.new(1, 0.0105 / 0.2, 1) | |
145 | local Weld = Instance.new("Weld", Part) | |
146 | Weld.Part0 = Weld.Parent | |
147 | Weld.Part1 = MasterPart2 | |
148 | Weld.C0 = CFrame.new(0, 0.1, 0) | |
149 | ||
150 | local Part = Instance.new("Part") | |
151 | Part.Material = "Neon" | |
152 | Part.Name = "Hand Center" | |
153 | Part.FormFactor = "Custom" | |
154 | Part.Size = Vector3.new(0.2, 0.2, 0.2) | |
155 | Part.BrickColor = CenterHandColor | |
156 | Part.TopSurface = 0 | |
157 | Part.BottomSurface = 0 | |
158 | Part.Parent = Parts | |
159 | Instance.new("CylinderMesh", Part).Scale = Vector3.new(0.035 / 0.2, 0.04 / 0.2, 0.035 / 0.2) | |
160 | local Weld = Instance.new("Weld", Part) | |
161 | Weld.Part0 = Weld.Parent | |
162 | Weld.Part1 = MasterPart2 | |
163 | Weld.C0 = CFrame.new(0, 0.1, 0) | |
164 | ||
165 | for i = 0, 360, 360 / 20 do | |
166 | if i % (360 / 4) ~= 0 then | |
167 | local Part = Instance.new("Part") | |
168 | Part.Material = "Neon" | |
169 | Part.Name = "Notch 1" | |
170 | Part.FormFactor = "Custom" | |
171 | Part.Size = Vector3.new(0.2, 0.2, 0.2) | |
172 | Part.BrickColor = NotchColor1 | |
173 | Part.TopSurface = 0 | |
174 | Part.BottomSurface = 0 | |
175 | Part.Parent = Parts | |
176 | Instance.new("BlockMesh", Part).Scale = Vector3.new(0.01 / 0.2, 0.01075 / 0.2, 0.03 / 0.2) | |
177 | local Weld = Instance.new("Weld", Part) | |
178 | Weld.Part0 = Weld.Parent | |
179 | Weld.Part1 = MasterPart2 | |
180 | Weld.C0 = CFrame.new(0, 0.1, 0.17) * CFrame.fromEulerAnglesXYZ(0, math.rad(i), 0) | |
181 | end | |
182 | end | |
183 | ||
184 | for i = 0, 360, 360 / 4 do | |
185 | local Part = Instance.new("Part") | |
186 | Part.Material = "Neon" | |
187 | Part.Name = "Notch 2" | |
188 | Part.FormFactor = "Custom" | |
189 | Part.Size = Vector3.new(0.2, 0.2, 0.2) | |
190 | Part.BrickColor = NotchColor2 | |
191 | Part.TopSurface = 0 | |
192 | Part.BottomSurface = 0 | |
193 | Part.Parent = Parts | |
194 | Instance.new("BlockMesh", Part).Scale = Vector3.new(0.02 / 0.2, 0.011 / 0.2, 0.05 / 0.2) | |
195 | local Weld = Instance.new("Weld", Part) | |
196 | Weld.Part0 = Weld.Parent | |
197 | Weld.Part1 = MasterPart2 | |
198 | Weld.C0 = CFrame.new(0, 0.1, 0.17) * CFrame.fromEulerAnglesXYZ(0, math.rad(i), 0) | |
199 | end | |
200 | ||
201 | local Part = Instance.new("Part") | |
202 | Part.Material = "Neon" | |
203 | Part.Name = "Hand Hour" | |
204 | Part.FormFactor = "Custom" | |
205 | Part.Size = Vector3.new(0.2, 0.2, 0.2) | |
206 | Part.BrickColor = HourHandColor | |
207 | Part.TopSurface = 0 | |
208 | Part.BottomSurface = 0 | |
209 | Part.Parent = Parts | |
210 | Instance.new("BlockMesh", Part).Scale = Vector3.new(0.03 / 0.2, 0.015 / 0.2, 0.1 / 0.2) | |
211 | local Weld = Instance.new("Weld", Part) | |
212 | Weld.Part0 = Weld.Parent | |
213 | Weld.Part1 = MasterPart2 | |
214 | Weld.C0 = CFrame.new(0, 0.11, 0.05) | |
215 | ||
216 | local Part = Instance.new("Part") | |
217 | Part.Material = "Neon" | |
218 | Part.Name = "Hand Minute" | |
219 | Part.FormFactor = "Custom" | |
220 | Part.Size = Vector3.new(0.2, 0.2, 0.2) | |
221 | Part.BrickColor = MinuteHandColor | |
222 | Part.TopSurface = 0 | |
223 | Part.BottomSurface = 0 | |
224 | Part.Parent = Parts | |
225 | Instance.new("BlockMesh", Part).Scale = Vector3.new(0.02 / 0.2, 0.0125 / 0.2, 0.15 / 0.2) | |
226 | local Weld = Instance.new("Weld", Part) | |
227 | Weld.Part0 = Weld.Parent | |
228 | Weld.Part1 = MasterPart2 | |
229 | Weld.C0 = CFrame.new(0, 0.11, 0.075) | |
230 | ||
231 | local Part = Instance.new("Part") | |
232 | Part.Material = "Neon" | |
233 | Part.Name = "Hand Second" | |
234 | Part.FormFactor = "Custom" | |
235 | Part.Size = Vector3.new(0.2, 0.2, 0.2) | |
236 | Part.BrickColor = SecondHandColor | |
237 | Part.TopSurface = 0 | |
238 | Part.BottomSurface = 0 | |
239 | Part.Parent = Parts | |
240 | Instance.new("BlockMesh", Part).Scale = Vector3.new(0.01 / 0.2, 0.01 / 0.2, 0.17 / 0.2) | |
241 | local Weld = Instance.new("Weld", Part) | |
242 | Weld.Part0 = Weld.Parent | |
243 | Weld.Part1 = MasterPart2 | |
244 | Weld.C0 = CFrame.new(0, 0.11, 0.085) | |
245 | ||
246 | for _, Part in pairs(Parts:GetChildren()) do | |
247 | Part.Locked = true | |
248 | Part.CanCollide = false | |
249 | end | |
250 | ||
251 | coroutine.wrap(function() | |
252 | while Parts.Parent ~= nil do | |
253 | local Hours, Minutes, Seconds = Time() | |
254 | --SoundToServer("Tick", "http://www.roblox.com/Asset/?id=14863866", 5, 0.5, false, Parts:FindFirstChild("Watch")) | |
255 | pcall(function() Parts["Hand Hour"].Weld.C1 = CFrame.fromEulerAnglesXYZ(0, (math.pi * (Hours / 12) * 2) - math.rad(90), 0) end) | |
256 | pcall(function() Parts["Hand Minute"].Weld.C1 = CFrame.fromEulerAnglesXYZ(0, (math.pi * (Minutes / 60) * 2) - math.rad(90), 0) end) | |
257 | pcall(function() Parts["Hand Second"].Weld.C1 = CFrame.fromEulerAnglesXYZ(0, (math.pi * (Seconds / 60) * 2) - math.rad(90), 0) end) | |
258 | wait(1) | |
259 | end | |
260 | end)() | |
261 | end | |
262 | ||
263 | ||
264 | function RemoveParts(Parent, Format) | |
265 | if Format == 1 then | |
266 | pcall(function() Parent[ModelName.. " (Holstered)"]:Remove() end) | |
267 | elseif Format == 2 then | |
268 | pcall(function() Parent[ModelName]:Remove() end) | |
269 | end | |
270 | end | |
271 | ||
272 | ||
273 | function SetAngle(Joint, Angle, Character) | |
274 | if Character == nil then return false end | |
275 | local Joints = { | |
276 | Character.Torso:FindFirstChild("Right Shoulder 2"), | |
277 | Character.Torso:FindFirstChild("Left Shoulder 2"), | |
278 | Character.Torso:FindFirstChild("Right Hip 2"), | |
279 | Character.Torso:FindFirstChild("Left Hip 2") | |
280 | } | |
281 | if Joints[Joint] == nil then return false end | |
282 | if Joint == 1 or Joint == 3 then | |
283 | Joints[Joint].DesiredAngle = Angle | |
284 | end | |
285 | if Joint == 2 or Joint == 4 then | |
286 | Joints[Joint].DesiredAngle = -Angle | |
287 | end | |
288 | end | |
289 | ||
290 | ||
291 | function ForceAngle(Joint, Angle, Character) | |
292 | if Character == nil then return false end | |
293 | local Joints = { | |
294 | Character.Torso:FindFirstChild("Right Shoulder 2"), | |
295 | Character.Torso:FindFirstChild("Left Shoulder 2"), | |
296 | Character.Torso:FindFirstChild("Right Hip 2"), | |
297 | Character.Torso:FindFirstChild("Left Hip 2") | |
298 | } | |
299 | if Joints[Joint] == nil then return false end | |
300 | if Joint == 1 or Joint == 3 then | |
301 | Joints[Joint].DesiredAngle = Angle | |
302 | Joints[Joint].CurrentAngle = Angle | |
303 | end | |
304 | if Joint == 2 or Joint == 4 then | |
305 | Joints[Joint].DesiredAngle = -Angle | |
306 | Joints[Joint].CurrentAngle = -Angle | |
307 | end | |
308 | end | |
309 | ||
310 | ||
311 | function SetSpeed(Joint, Speed, Character) | |
312 | if Character == nil then return false end | |
313 | local Joints = { | |
314 | Character.Torso:FindFirstChild("Right Shoulder 2"), | |
315 | Character.Torso:FindFirstChild("Left Shoulder 2"), | |
316 | Character.Torso:FindFirstChild("Right Hip 2"), | |
317 | Character.Torso:FindFirstChild("Left Hip 2") | |
318 | } | |
319 | if Joints[Joint] == nil then return false end | |
320 | Joints[Joint].MaxVelocity = Speed | |
321 | end | |
322 | ||
323 | ||
324 | function DisableLimb(Limb, Character) | |
325 | if Character == nil then return false end | |
326 | if Character:FindFirstChild("Torso") == nil then return false end | |
327 | local Joints = { | |
328 | Character.Torso:FindFirstChild("Right Shoulder"), | |
329 | Character.Torso:FindFirstChild("Left Shoulder"), | |
330 | Character.Torso:FindFirstChild("Right Hip"), | |
331 | Character.Torso:FindFirstChild("Left Hip") | |
332 | } | |
333 | local Limbs = { | |
334 | Character:FindFirstChild("Right Arm"), | |
335 | Character:FindFirstChild("Left Arm"), | |
336 | Character:FindFirstChild("Right Leg"), | |
337 | Character:FindFirstChild("Left Leg") | |
338 | } | |
339 | if Joints[Limb] == nil then return false end | |
340 | if Limbs[Limb] == nil then return false end | |
341 | local Joint = Instance.new("Motor6D") | |
342 | Joint.Parent = Character.Torso | |
343 | Joint.Part0 = Character.Torso | |
344 | Joint.Part1 = Limbs[Limb] | |
345 | if Limb == 1 then | |
346 | Joint.C0 = CFrame.new(1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0) | |
347 | Joint.C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0) | |
348 | Joint.Name = "Right Shoulder 2" | |
349 | elseif Limb == 2 then | |
350 | Joint.C0 = CFrame.new(-1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0) | |
351 | Joint.C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0) | |
352 | Joint.Name = "Left Shoulder 2" | |
353 | elseif Limb == 3 then | |
354 | Joint.C0 = CFrame.new(0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0) | |
355 | Joint.C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0) | |
356 | Joint.Name = "Right Hip 2" | |
357 | elseif Limb == 4 then | |
358 | Joint.C0 = CFrame.new(-0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0) | |
359 | Joint.C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0) | |
360 | Joint.Name = "Left Hip 2" | |
361 | end | |
362 | Joint.MaxVelocity = Joints[Limb].MaxVelocity | |
363 | Joint.CurrentAngle = Joints[Limb].CurrentAngle | |
364 | Joint.DesiredAngle = Joints[Limb].DesiredAngle | |
365 | Joints[Limb]:Remove() | |
366 | end | |
367 | ||
368 | ||
369 | function ResetLimbCFrame(Limb, Character) | |
370 | if Character == nil then return false end | |
371 | if Character.Parent == nil then return false end | |
372 | if Character:FindFirstChild("Torso") == nil then return false end | |
373 | local Joints = { | |
374 | Character.Torso:FindFirstChild("Right Shoulder 2"), | |
375 | Character.Torso:FindFirstChild("Left Shoulder 2"), | |
376 | Character.Torso:FindFirstChild("Right Hip 2"), | |
377 | Character.Torso:FindFirstChild("Left Hip 2") | |
378 | } | |
379 | local Limbs = { | |
380 | Character:FindFirstChild("Right Arm"), | |
381 | Character:FindFirstChild("Left Arm"), | |
382 | Character:FindFirstChild("Right Leg"), | |
383 | Character:FindFirstChild("Left Leg") | |
384 | } | |
385 | if Joints[Limb] == nil then return false end | |
386 | if Limbs[Limb] == nil then return false end | |
387 | if Limb == 1 then | |
388 | Joints[Limb].C0 = CFrame.new(1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0) | |
389 | Joints[Limb].C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0) | |
390 | elseif Limb == 2 then | |
391 | Joints[Limb].C0 = CFrame.new(-1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0) | |
392 | Joints[Limb].C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0) | |
393 | elseif Limb == 3 then | |
394 | Joints[Limb].C0 = CFrame.new(0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0) | |
395 | Joints[Limb].C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0) | |
396 | elseif Limb == 4 then | |
397 | Joints[Limb].C0 = CFrame.new(-0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0) | |
398 | Joints[Limb].C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0) | |
399 | end | |
400 | end | |
401 | ||
402 | ||
403 | function EnableLimb(Limb, Character) | |
404 | if Character == nil then return false end | |
405 | if Character:FindFirstChild("Torso") == nil then return false end | |
406 | local Joints = { | |
407 | Character.Torso:FindFirstChild("Right Shoulder 2"), | |
408 | Character.Torso:FindFirstChild("Left Shoulder 2"), | |
409 | Character.Torso:FindFirstChild("Right Hip 2"), | |
410 | Character.Torso:FindFirstChild("Left Hip 2") | |
411 | } | |
412 | local Limbs = { | |
413 | Character:FindFirstChild("Right Arm"), | |
414 | Character:FindFirstChild("Left Arm"), | |
415 | Character:FindFirstChild("Right Leg"), | |
416 | Character:FindFirstChild("Left Leg") | |
417 | } | |
418 | if Joints[Limb] == nil then return false end | |
419 | if Limbs[Limb] == nil then return false end | |
420 | if Limb == 1 then | |
421 | Joints[Limb].Name = "Right Shoulder" | |
422 | elseif Limb == 2 then | |
423 | Joints[Limb].Name = "Left Shoulder" | |
424 | elseif Limb == 3 then | |
425 | Joints[Limb].Name = "Right Hip" | |
426 | elseif Limb == 4 then | |
427 | Joints[Limb].Name = "Left Hip" | |
428 | end | |
429 | Animate = Character:FindFirstChild("Animate") | |
430 | if Animate == nil then return false end | |
431 | Animate = Animate:Clone() | |
432 | Character.Animate:Remove() | |
433 | Animate.Parent = Character | |
434 | end | |
435 | ||
436 | ||
437 | function onButton1Down(Mouse) | |
438 | if Button1Down == true then return end | |
439 | Button1Down = true | |
440 | if CheckPlayer() == false then return end | |
441 | if CanUse == true then | |
442 | CanUse = false | |
443 | DisableLimb(1, Player.Character) | |
444 | SetSpeed(1, 0.5, Player.Character) | |
445 | SetAngle(1, 0, Player.Character) | |
446 | RemoveParts(Player.Character, 1) | |
447 | CreateParts(Player.Character, 2) | |
448 | wait(0.2) | |
449 | for i = 0, 1, 0.075 do | |
450 | pcall(function() | |
451 | Player.Character.Torso.Neck.C0 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(math.rad(-90 - (40 * i)), math.rad(-5 * i), math.rad(180 - (15 * i))) | |
452 | Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new(1.5 - (0.15 * i), 0.5, -0.2 * i) * CFrame.fromEulerAnglesXYZ(math.rad(100 * i), math.rad(90 + (130 * i)), math.rad(40 * i)) | |
453 | end) | |
454 | wait() | |
455 | end | |
456 | pcall(function() | |
457 | Player.Character.Torso.Neck.C0 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(math.rad(-130), math.rad(-5), math.rad(165)) | |
458 | Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new(1.35, 0.5, -0.2) * CFrame.fromEulerAnglesXYZ(math.rad(100), math.rad(220), math.rad(40)) | |
459 | end) | |
460 | wait(0.1) | |
461 | CanUse = true | |
462 | coroutine.wrap(function() | |
463 | while Selected == true and Button1Down == true do | |
464 | wait() | |
465 | end | |
466 | CanUse = false | |
467 | for i = 1, 0, -0.075 do | |
468 | pcall(function() | |
469 | Player.Character.Torso.Neck.C0 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(math.rad(-90 - (40 * i)), math.rad(-5 * i), math.rad(180 - (15 * i))) | |
470 | Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new(1.5 - (0.15 * i), 0.5, -0.2 * i) * CFrame.fromEulerAnglesXYZ(math.rad(100 * i), math.rad(90 + (130 * i)), math.rad(40 * i)) | |
471 | end) | |
472 | wait() | |
473 | end | |
474 | pcall(function() | |
475 | Player.Character.Torso.Neck.C0 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(math.rad(-90), 0, math.rad(180)) | |
476 | end) | |
477 | ResetLimbCFrame(1, Player.Character) | |
478 | EnableLimb(1, Player.Character) | |
479 | RemoveParts(Player.Character, 2) | |
480 | CreateParts(Player.Character, 1) | |
481 | CanUse = true | |
482 | end)() | |
483 | end | |
484 | end | |
485 | ||
486 | ||
487 | function onButton1Up(Mouse) | |
488 | Button1Down = false | |
489 | end | |
490 | ||
491 | ||
492 | function onKeyDown(Key, Mouse) | |
493 | if Selected == false then return end | |
494 | Key = Key:lower() | |
495 | if Button1Down == false and CanUse == true and CheckPlayer() == true then | |
496 | if Key == "q" then | |
497 | if Mouse.Target == nil then return end | |
498 | if CheckPlayer() == false then return end | |
499 | local NewPlayer = game:GetService("Players"):GetPlayerFromCharacter(Mouse.Target.Parent) | |
500 | if NewPlayer == nil then return end | |
501 | if NewPlayer.Character == nil then return end | |
502 | if NewPlayer.Character:FindFirstChild("Torso") == nil then return end | |
503 | if (NewPlayer.Character.Torso.Position - Player.Character.Torso.Position).magnitude > 10 then return end | |
504 | onDeselected(Mouse) | |
505 | wait() | |
506 | RemoveParts(Player.Character, 1) | |
507 | script.Parent.Parent = NewPlayer.Backpack | |
508 | Player = NewPlayer | |
509 | end | |
510 | end | |
511 | end | |
512 | ||
513 | ||
514 | function onSelected(Mouse) | |
515 | if Selected == true or CanUse == false then return end | |
516 | CanUse = false | |
517 | while true do | |
518 | if CheckPlayer() == true then | |
519 | if Player.Character.Torso:FindFirstChild("Right Shoulder") ~= nil then | |
520 | break | |
521 | end | |
522 | end | |
523 | wait(0.1) | |
524 | end | |
525 | Selected = true | |
526 | Mouse.Icon = "rbxasset://textures\\GunCursor.png" | |
527 | Mouse.Button1Down:connect(function() onButton1Down(Mouse) end) | |
528 | Mouse.Button1Up:connect(function() onButton1Up(Mouse) end) | |
529 | Mouse.KeyDown:connect(function(Key) onKeyDown(Key, Mouse) end) | |
530 | CanUse = true | |
531 | end | |
532 | ||
533 | ||
534 | function onDeselected(Mouse) | |
535 | if Selected == false then return end | |
536 | Selected = false | |
537 | end | |
538 | ||
539 | ||
540 | if script.Parent.ClassName ~= "HopperBin" then | |
541 | if Player == nil then print("Error: Player not found!") return end | |
542 | Tool = Instance.new("HopperBin") | |
543 | Tool.Name = ModelName | |
544 | Tool.Parent = Player.Backpack | |
545 | script.Name = "Main" | |
546 | script.Parent = Tool | |
547 | elseif script.Parent.ClassName == "HopperBin" and Connected == false then | |
548 | Connected = true | |
549 | Player = script.Parent.Parent.Parent | |
550 | end wait() if script.Parent.ClassName == "HopperBin" then | |
551 | while script.Parent.Parent.ClassName ~= "Backpack" do | |
552 | wait() | |
553 | end | |
554 | script.Parent.Selected:connect(onSelected) | |
555 | script.Parent.Deselected:connect(onDeselected) | |
556 | CreateParts(Player.Character, 1) | |
557 | ||
558 | end |