I have been trying the old script
01 | 01 local debounce = false |
02 | 02 |
03 | 03 function getPlayer(humanoid) |
04 | 04 local players = game.Players:children() |
05 | 05 for i = 1 , #players do |
06 | 06 if players [ i ] .Character.Humanoid = = humanoid then return players [ i ] end |
07 | 07 end |
08 | 08 return nil |
09 | 09 end |
10 | 10 |
11 | 11 function onTouch(part) |
12 | 12 |
13 | 13 local human = part.Parent:findFirstChild( "Humanoid" ) |
14 | 14 if (human ~ = nil ) and debounce = = false then |
15 | 15 |
This is the one that doesn't work.
So I tried fixing it but it still didn't work. Can you help me?
This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.
Why was this question closed?
Change line 22 to something to point to where you have your gear such as serverstorage...
1 | game:GetService( "ServerStorage" ).YOURGEAR:clone().Parent = player.Backpack |
What your going to have to do is detect when the part is touched on the server, then clone a tool to their backpack (or character for instant equip).
01 | local Player = game:GetService( 'Players' ) |
02 |
03 | local Tool = script.Tool -- Put the tool in the script |
04 | local Part = workspace.Part -- Define the part here |
05 |
06 | local Debounce = false |
07 |
08 | Part.Touched:Connect( function (Obj) |
09 | if Debounce then return end |
10 | Debounce = true |
11 | local Player = Players:GetPlayerFromCharacter(Obj.Parent) |
12 | if Player then |
13 | Tool:Clone().Parent = Player.Backpack |
14 | wait( 1 ) |
15 | Debounce = false |
16 | end |
17 | end ) |