Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Why isn't my script with GetPropertyChangedSignal working?

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

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.

1 comment

0

Still not working, no error this time though.

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.

1 comment

0

My computer froze while i was editing and accidentally removed it but i just reposted it

This discussion is preserved as it was. New answers, comments, and votes are closed.