so when a player has 100 or more Gelatine they click a button that should reset their Gelatine value
it does but when they collect something to earn the Gelatine they get the Gelatine value from before back any idea how this can be happening (still learning the basics)
local button = script.Parent
local player = game.Players.LocalPlayer
button.MouseButton1Click:Connect(function()
if player.leaderstats.Gelatine.Value >=100 then
player.leaderstats.TimeTravel.Value = player.leaderstats.TimeTravel.Value +1
player.leaderstats.Gelatine.Value = 0
player.leaderstats.Gems.Value = player.leaderstats.Gems.Value +1
if player.leaderstats.Gelatine.Value <=99 then
end
end
end)
local button = script.Parent
local player = game.Players.LocalPlayer
button.MouseButton1Click:Connect(function()
if player.leaderstats.Gelatine.Value >= 100 then
player.leaderstats.TimeTravel.Value += 1
player.leaderstats.Gelatine.Value = 0
player.leaderstats.Gems.Value += 1
else
end
end)
a person collects objects these object give a currecny called Gelatine and when they have 100 or more they can press a button to reset so 0 Gelatine but when you collect an object again it gives the (100 or the value you had before)
local db = true
script.Parent.Touched:connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") ~= nil then
if db == true then
db = false
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
local TimeTravel = player.leaderstats.TimeTravel.Value
local randomx = math.random(-79.502,-19.821)
local randomz = math.random(187.942,207.703)
if player.leaderstats.TimeTravel.Value ==0 then
player.leaderstats.Gelatine.Value = player.leaderstats.Gelatine.Value + 1
script.Parent.Position = Vector3.new(randomx,14.815,randomz)
script.Parent.Parent.bear2.Position = Vector3.new(randomx,17.665,randomz-.2)
wait(.5)
db = true
else
if player.leaderstats.TimeTravel.Value <=1 then
player.leaderstats.Gelatine.Value = player.leaderstats.Gelatine.Value + 1 *player.leaderstats.TimeTravel.Value
script.Parent.Position = Vector3.new(randomx,14.815,randomz)
script.Parent.Parent.bear2.Position = Vector3.new(randomx,17.665,randomz-.2)
wait(.5)
db = true
end
end
end
end
end)
is there some sort of other value in serverStorage or somewhere that is the actual player gelatine while the one in leaderstats just copys that value ?