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

Why isn't my script with GetPropertyChangedSignal working?

Asked by 4 years ago

Doesn't show anything on the logs.

script.Parent.Value:GetPropertyChangedSignal("Value"):Connect(function()
    local value = script.Parent.Value.Value
    local text = script.Parent.SurfaceGui.TextLabel.Text
    if value <= 2 then
        if value == 1 then
            text = "10   ?OS. ZALESIE"
        else
            --text = "CZAS " .. tostring():sub(1, -2)
            wait(1)
            text = "D?BOWA"
        end
    elseif value <= 4 then
        if value == 3 then
            text = "N/A"
        else
            text = "N/A"
        end
else
    text = "N/A"
    end
end)

2 answers

Log in to vote
0
Answered by
Txeer 46
4 years ago

Try using the .Changed function. You would do so like this:


script.Parent.Changed:Connect(function() local value = script.Parent.Value.Value local text = script.Parent.SurfaceGui.TextLabel.Text if value <= 2 then if value == 1 then text = "10 ?OS. ZALESIE" else -- text = "CZAS " .. tostring():sub(1, -2) wait(1) text = "D?BOWA" end elseif value <= 4 then if value == 3 then text = "N/A" else text = "N/A" end else text = "N/A" end end)

You cannot directly check if the value changed with the .Changed function. It is a function of the instance and not the property, hope this helps.

0
Still not working, no error this time though. Ralfotr 2 — 4y
Ad
Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

GetPropertyChangedSignal is deprecated i think try

script.Parent.Value.Changed:Connect(function()
    local value = script.Parent.Value.Value
    local text = script.Parent.SurfaceGui.TextLabel.Text
    if value <= 2 then
        if value == 1 then
            text = "10   ?OS. ZALESIE"
        else
            --text = "CZAS " .. tostring():sub(1, -2)
            wait(1)
            text = "D?BOWA"
        end
    elseif value <= 4 then
        if value == 3 then
            text = "N/A"
        else
            text = "N/A"
        end
else
    text = "N/A"
    end
end)

Use Changed instead.

0
My computer froze while i was editing and accidentally removed it but i just reposted it EnzoTDZ_YT 275 — 4y

Answer this question