Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

[solved] in a weird way, why do these 2 scripts print different values?

Asked by 5 years ago
Edited 5 years ago

clickdetector script:

script.Parent.MouseClick:Connect(function(player)
    local value = game.Workspace.water_tank.tank.water_value
    print(value.Value)
        game.Players[player.Name].leaderstats.Dollars.Value = game.Players[player.Name].leaderstats.Dollars.Value + value.Value
        value.Value = 0
end)

prints 0 water tank script:

local value = script.Parent.water_value.Value
local label = script.Parent.Parent.gui.gui_part.SurfaceGui.TextLabel
local text = label.Text
while true do
    wait(1)
    if value < 20000 then
        text = "Tank not filled"
        label.BackgroundColor3 = Color3.new(255,0,0)
        value = value + 1
        print(value)
    else 
        label.BackgroundColor3 = Color3.new(0,255,0)
        text = "Tank filled"
    end
end

prints 1 then 2 etc also when i check with explorer during testing the value doesnt go up

Answer this question