So I am making a new game with a Coconuts currency and a level system but I want Coconuts to give both Coconuts and Experience (I already have the level system) but how do I make one Coconut give both? Here is my script:
currency = "Coconut"
amnt = 1
debounce = false
function onTouch(hit)
if hit.Parent:findFirstChild("Humanoid") ~= nil and debounce == false then
if game.Players:findFirstChild(hit.Parent.Name) ~= nil then
ThisPlayer = game.Players:findFirstChild(hit.Parent.Name)
ThisPlayer.leaderstats:findFirstChild(currency).Value = ThisPlayer.leaderstats:findFirstChild(currency).Value + amnt
script.Sound:Play()
script.Parent.Transparency = 1
script.Parent.CanCollide = false
debounce = true
wait(15)
script.Parent.Transparency = 0
script.Parent.CanCollide = false
debounce = false
end
end
end
script.Parent.Touched:connect(onTouch)

1 comment
How do you keep track of experience in your game?