Need help for this script
local img = game.StarterGui.AddCoinsGui:FindFirstChild("ImageLabel")
local text = game.StarterGui.AddCoinsGui:FindFirstChild("TextLabel")
local trusses = game.Workspace.Spawn.Trusses:FindFirstChild("Trusses")
local Players = game:GetService("Players")
for _, v in pairs(trusses:GetChildren()) do
if v:IsA("TrussPart") then
v.Touched:Connect(function(player)
if player:FindFirstChild("leaderstats") then
player.leaderstats.Coins.Value = player.leaderstats.Coins.Value + 5
print("+5")
end
end)
end
end
It is supposed to give the player + 5 coins when he touches the trussparts in the model but it isn't finding the leaderstats