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

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

Asked by 6 years ago

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
0
try removing the .Value on line 2 and add a .Value on all currentstates in the conditionals? radusavin366 617 — 6y
0
Tried it, didn't work Lolgamer33221 0 — 6y

1 answer

Log in to vote
1
Answered by 6 years ago

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

Ad

Answer this question