I’m trying to check if an IntValue is bigger than a different IntValue
while wait(0.1) do
local soul = script.Parent.Parent:WaitForChild("leaderstats").Soul
local dirt = script.Parent.Parent:WaitForChild("vals").Dirt
local req1 = script.Parent.Parent:WaitForChild("reqs").req1
local dirtBtn = game.Workspace.dirtButton
local holder = dirtBtn.GUI.text
if soul.Value >= req1.Value then
print(req1.Value)
holder.TextColor3 = Color3.fromRGB(38, 255, 0)
else
holder.TextColor3 = Color3.fromRGB(38, 255, 0)
end
end
It technally works, but in this script (localscript) the value is always 0 (the number assigned in the creation of the value). Therefor it is constantly the first colour because req1 is always 0 (so soul value is bigger) outside the script below.
In my other script (localscript) I change the value.
local holder = dirtBtn.GUI.text
local req1 = script.Parent.Parent:WaitForChild("reqs").req1.Value
req1 = 5 + (dirt.Value * 3)
holder.Text = req1.." Soul"
local ready = true
dirtBtn.Touched:Connect(function(hit,req1)
req1 = 5 + (dirt.Value * 3)
holder.Text = req1.." Soul"
if soul.Value >= req1 then
if ready == true then
ready = false
local char = game.Players.LocalPlayer.Character
if hit.Parent == char then
dirt.Value += 1
dirtGui.Text = "Dirt: "..dirt.Value
soul.Value -= req1
soulGui.Text = "Soul: "..soul.Value
wait(0.5)
ready = true
return req1
end
end
end
end)
I though this was because it couldn’t communicate with the server, but here in my other script it updates the “Soul” value just fine.
while wait(SOULWAIT.Value) do
soul.Value += 1 + dirt.Value
soulGui.Text = "Soul: "..soul.Value
end
So I am asking why “req1” doesn’t update for my other scripts and stays on 0, but “Soul” updates just fine.