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

Script when a value is in a range of numbers?

workspace.TimeSurived:GetPropertyChangedSignal("Value"):Connect(function()
    if workspace.TimeSurived.Value 40-60 then
--code here
end 
end)

1 comment

0

Do "if game.Workspace.TimeSurvived.Value >= 40 or game.Workspace.TimeSurvived.Value <= 60 then"

2 answers

"and" runs the code only if both requirements are met. So, it's checking if the value is greater than or equal to 40 AND is less than or equal to 60.

workspace.TimeSurived:GetPropertyChangedSignal("Value"):Connect(function()
    if workspace.TimeSurived.Value >= 40 and  workspace.TimeSurived.Value <= 60 then
        --code here
    end 
end)
workspace.TimeSurived:GetPropertyChangedSignal("Value"):Connect(function()
	local val = workspace.TimeSurived.Value
	if val > 40 and val < 60 then
		-- code here
	end 
end)

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