I have a part and I want it when a player touches It, It gives them a tool and takes away their health. So I need access to their character in Workspace defined as a variable and to their Backpack.
function Touch(player) local player = game.Players:FindFirstChild("player") local character = game.Workspace:FindFirstChild("player") game.ServerStorage.Tool:Clone().Parent = player.Backpack character.Health = character.Health - 50 end script.Parent.Touched:connect(Touch)
function Touch(part) local character = part.Parent if game.Players:GetPlayerFromCharacter(character) then local player = game.Players:FindFirstChild(character.Name) game.ServerStorage.Tool:Clone().Parent = player.Backpack character.Humanoid.Health = character.Humanoid.Health - 50 end end script.Parent.Touched:connect(Touch) -- Guessing script in part