01 | local Part = script.Parent |
02 | local Tool = game.Lighting.GravityCoil |
03 | local Player = game.Players:GetPlayerFromCharacter(Part.Parent) |
04 | local Debounce = false |
05 |
06 | if Tool and Part then |
07 | Part.Touched:connect( function (Part) |
08 | local Humanoid = Part.Parent.Parent.Parent.Parent.Parent.Parent:FindFirstChild( 'Humanoid' ) |
09 | if Humanoid and Debounce = = false then |
10 | Debounce = true |
11 | local Player = game.Players:GetPlayerFromCharacter(Part.Parent) |
12 | if Player then |
13 | local ClonedTool = Tool:Clone() |
14 | ClonedTool.Parent = Player.Backpack |
15 | wait( 10 ) |
Error:
01 | local part = script.Parent; |
02 | local tool = game:GetService( "ServerStorage" ):FindFirstChild( "GravityCoil" ); -- Move your gravity coil to Server storage, it doesn't belong in lighting. |
03 | local debounce = true ; |
04 |
05 | if (tool) then |
06 | part.Touched:connect( function (touchee) |
07 | local player = game:GetService( "Players" ):GetPlayerFromCharacter(touchee.Parent); |
08 | if (player and debounce) then |
09 | tool:Clone().Parent = player.Backpack; |
10 | debounce = false ; |
11 | wait( 10 ); |
12 | debounce = true ; |
13 | end |
14 | end ) |
15 | end |