When a player touches temp his leaderboard will change to the value of temp, if a player touch tamp theirs will change to that value.
Why in one script? Less lag.
Temperature (Model) > MasterScript > TAMP (part) > TEMP (part)
local ting = 0
function onTouched(hit)
if ting == 0 then
ting = 1
check = hit.Parent:FindFirstChild("Humanoid")
if check ~= nil then
local user = game.Players:GetPlayerFromCharacter(hit.Parent)
local stats = user:findFirstChild("leaderstats")
if stats ~= nil then
local cash = stats:findFirstChild("F")
if cash.Value >= 0 then
cash.Value = cash.Value == 23
end
local cash = stats:findFirstChild("C")
if cash.Value >= 0 then
cash.Value = cash.Value == ("-5")
end
script.Parent.TAMP.Touched:connect(onTouched)
end
if stats ~= nil then
local cash = stats:findFirstChild("F")
if cash.Value >= 0 then
cash.Value = cash.Value == 34
end
local cash = stats:findFirstChild("C")
if cash.Value >= 0 then
cash.Value = cash.Value == 1
end
script.Parent.TEMP.Touched:connect(onTouched)
end
end
ting = 0
end
end

1 comment
findFirstChild is deprecated, us FindFirstChild, and cash.Value = cash.Value + 23