I am trying to use the value to teleport to a place. For some reason this script does not work!
Here is my script (its in a button of a gui) LOCAL SCRIPT
local button = script.Parent
button.MouseButton1Click:connect(function()
if game.Players.LocalPlayer.leaderstats.Coins.Value >= 5 then
game.Workspace.Tp1.tppart.Value.Value = game.Players.LocalPlayer.leaderstats.Coins.Value -5
print("Success")
script.Parent.Parent.Visible = false
else
script.Parent.Parent.TextBox.Text = ("You don't have enough coins!")
end
end)
btw this is the other script: NORMAL SCRIPT
function onTouched(hit)
character = hit.Parent
if character then
game:GetService("TeleportService"):Teleport(script.Parent.Value.Value, character)
end
end
script.Parent.Touched:connect(onTouched)
End when the value does work then it gives a warning: Cannot teleport to invalid place id 0. Aborting teleport.

4 comments
You shouldn't change values for leaderstats on the client. It also won't replicate to the server from the client.
How do I fix this?
You should use a server script in all cases to modify leaderstats. And one way to fix it is to use a RemoteEvent to fire the server, have it modify their money, then teleport if they have enough
but the leaderstats work