hello i iz back
So I have a Part called purple. When a player touches it, the player gets a two tools. The problem is neither of the tools are entering the player's Backpack.
The Script:
local storage = game:WaitForChild("ReplicatedStorage") local cancollecttools = true local shank = storage:WaitForChild("PurpleShank") local power = storage:WaitForChild("Gyroball") local teams = game:WaitForChild("Teams") local green = teams:WaitForChild('Purple') script.Parent.Touched:connect(function(hit) local character = hit.Parent local player = game.Players:GetPlayerFromCharacter(character) if player ~= nil and cancollectsword == true then player.TeamColor = green.TeamColor shank:Clone().Parent = player.Backpack power:Clone().Parent = player.Backpack cancollecttools = false end end)
The output says nothing. Help?
The problem is you're using the wrong variable on line 10:
local storage = game:GetService("ReplicatedStorage") local cancollecttools = true local shank = storage:WaitForChild("PurpleShank") local power = storage:WaitForChild("Gyroball") local teams = game:GetService("Teams") local green = teams:WaitForChild('Purple') script.Parent.Touched:connect(function(hit) local character = hit.Parent local player = game.Players:GetPlayerFromCharacter(character) if player ~= nil and cancollecttools == true then player.TeamColor = green.TeamColor shank:Clone().Parent = player.Backpack power:Clone().Parent = player.Backpack cancollecttools = false end end)
I hope this helped. If it did please accept this as the answer. If it didn't feel free to ask any questions you have about it.