If statement not working[Solved]

So i’ve made a proximity prompt that triggers an if statement.
The problem is that the statement is true, but it doesn’t work.

local folder = script.Parent.Parent.IntValues
local eng = folder.Engine
local stabilizer = folder.Stabilizer
local walls = folder.Walls
local windows = folder.Windows
local fueltank = folder.FuelTank
local guidance = folder.Guidance

script.Parent.ProximityPrompt.Triggered:Connect(function()
	if eng == 1 and stabilizer == 2 and walls == 4 and windows == 4 and fueltank == 3 and guidance == 1 then
		script.Parent.ProximityPrompt:Destroy()
		script.Parent.BrickColor = BrickColor.new("Really red")
		script.Parent.Built:Play() --Audio
		game.ReplicatedStorage.RocketParts.Rocket.Parent = workspace
		script.Parent.Parent.PartsTextures:Destroy()
	end
end)

What type of instance is eng, stabilizer, etc.? Also, did you add any print statements to see if it is actually being fired?

All instances are IntValues. And I Did added prints. The statement is being fired

You need to put .Value infront of each of the IntValue

eng.Value, walls.Value and so on

1 Like

Add .Value to the end of each instance in the if statement. For example,

if eng.Value == 1 and stabilizer.Value == 2 and walls.Value == 4 and windows.Value == 4 and fueltank.Value == 3 and guidance.Value == 1 then

Oh, I forgot there, Thanks for helping

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.