12:11:17.152 Workspace.Daily Reward.ShopPart.Script:24: Expected ‘end’ (to close ‘function’ at line 5), got ; did you forget to close ‘then’ at line 7?
Hello, fellow developer!
The error in your script is that you are missing an end statement for the onTouch function. Here’s the corrected script:
coins = "Coins"
amnt = 50000
timer = 86400
debounce = false
function onTouch(hit)
if hit.Parent:findFirstChild("Humanoid") ~= nil and debounce == false then
if game.Players:findFirstChild(hit.Parent.Name) ~= nil then
local ThisPlayer = game.Players:findFirstChild(hit.Parent.Name)
ThisPlayer.leaderstats:findFirstChild(coins).Value = ThisPlayer.leaderstats:findFirstChild(coins).Value + amnt
script.Parent.Transparency = 0
script.Parent.CanCollide = false
debounce = true
wait(timer)
script.Parent.Transparency = 0
script.Parent.CanCollide = true
debounce = false
end
end
end
script.Parent.Touched:Connect(onTouch)
I also included a line at the end to connect the onTouch function to the Touched event of the script’s parent part. This will make sure the function is called whenever the part is touched.
I’m sorry if this not going to work, please reply if you have some questions or warnings.
first off:
that saving method will very quickly reach your datastore limit, try saving/getting on leave + join
second off:
you are going to need to load the players coin data, otherwise it will be reset
third off:
you are going to have to tab everything up, otherwise it wont be included in the function (i think)
yeah but you can only save a datastore so many times
if you reach the limit roblox will stop listening to your datastore calls, and thats not very good