Okay so i'm learning to script and just trying things out to get started and what i've tried to do here is to get the Gold.Value from Leaderstats and check if the player has enough gold, i've had a go but the function doesn't seem to run? and I get nil for gold?
tree = game.ReplicatedStorage.Pinetree
button = script.Parent
player = game:GetService("Players")
leaderstats = player:FindFirstChild("leaderstats")
localplayer = game.Players:GetPlayerFromCharacter(character)
function onTouched (hit)
if hit.Parent:FindFirstChild("Humanoid") and gold > 10 then
script.Parent:Destroy()
tree:Clone().Parent = game.Workspace
else
print "Get more money!"
end
end
button.Touched:Connect(onTouched)
I'll learn from my mistakes, it's all about trying and failing i suppose. :)
