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

Why is this if statement not running when the value changes?

This is a server script in a gui and I want it so when the value turns 1 then the code runs, why isn't it working should I use a remote event instead

if game.Workspace.Map1.ClickTele.Map1.Value == 1 then
-- my code
end

1 comment

0

Nah I removed my code because it is 2,000 lines long, so I put -- my code

1 answer

✓ Accepted answer

Hello There.


Solution:

You can connect a function to when the value of "Map1" gets changed, then it will check if the value is equal to 1.


Fixed Code:

game.Workspace.Map1.ClickTele.Map1:GetPropertyChangedSignal("Value"):Connect(function()
	if game.Workspace.Map1.ClickTele.Map1.Value == 1 then
		-- Your Code Here
	end
end)

1 comment

0

Thx

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