touchez = false function Burger(hit) if hit.Parent:findFirstChild("Humanoid") ~= nil then if not touchez then touchez = true script.Parent.Sound:Play() script.Parent.Smoke.Enabled = true wait(5) PP = game.ServerStorage.Burger:clone() PP.Parent = game.Players.localPlayer.Backpack script.Parent.Sound:Stop() script.Parent.Smoke.Enabled = false end wait(3) touchez = false end end script.Parent.Touchy.Touched:connect(Burger)
I'm completely aware that .localPlayer in a script does not work. I just tried it hoping that it would work
I'm trying to copy a tool from my game ServerStorage and place it into the players backpack, but I don't know how to find that specific player through a .Touched script.
I could place the object inside the player's character, but I don't want to have the problem in which if the player was holding an item already then it'll overlap and possibly cause a problem.
What can I do?
You will need to use GetPlayerFromCharacter()
You will need to do:
hit.Parent:GetPlayerFromCharacter(LocationOfHitsPlayer)
If you want more information on how this works, you should look here:
Info On GPFC (GetPlayerFromCharacter)
Hope this helped!