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

How Would I Make This Greater Than Or Less Than Script Work Properly?

I'm currently trying to figure out how to properly use greater than and less than scripts but am pretty much stuck at trying to figure out how to make this work properly, whenever I set the Currentstate value to anything lower than 8 nothing happens, neither with lower than 2. The CurrentState value is 10

local state = script.Parent.Head.States
local currentstate = script.Parent.CurrentState.Value
local face = script.Parent.Head.face

if currentstate >= 8 then
face.Texture = state.HappyState.Texture
	
end
if currentstate <= 8 then
face.Texture = state.NeutralState.Texture
end
if currentstate <= 2 then
face.Texture = state.SadState.Texture
end

2 comments

0

try removing the .Value on line 2 and add a .Value on all currentstates in the conditionals?

0

Tried it, didn't work

1 answer

I see a few problems with your script.

When you have the >= 8 and the <= 8, they will both fire when currentstate == 8, so i suggest picking one to have fire when it's 8.

Also, I suggest removing the .Value in line 2 (as someone else had pointed out). When you have that, once the game is ran the currentstate is automatically put to the default value, so nothing will work.

Hopefully this works, and if you have any questions, please feel free to ask them! :D

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