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