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

Part in model Transparency error?

Values = game.Workspace.Values.Value
script.Parent.MouseButton1Down:connect(function()
	if Values.OfficeDoorV.Value == "Closed"
		and Values.Obscure == "Visible"
		then game.Workspace.OfficeDoor.DoorFrame.Barrier.Transparency = 0
		game.Workspace.OfficeDoor.DoorFrame.Barrier.CanCollide = true
		Values.OfficeDoorV.Value = "Obscure"
		print("Obscure")
	elseif
		Values.OfficeDoorV.Value == "Open"
		and Values.Obscure == "Obscure"
		then game.Workspace.OfficeDoor.DoorFrame.Barrier.Transparency = 1
		game.Workspace.OfficeDoor.DoorFrame.Barrier.CanCollide = false
		print("Visible")
	end
end

The code leaves no errors, and yet does not function. Kind of irritating. If you know anything please point out where I goofed.

3 comments

0

Can you post the error message here?

0

It doesnt print anything. Output is unchanged.

0

I see you're not settign Values.Obscure to "Visible" in the elseif branch. Could that have something to do with it? Also, you're not using the 'Value' member of 'Values.Obscure' in your comparison. Use 'Values.Obscure.Value' instead.

1 answer

I'm going to assume it's because you're checking if an object is equal to a string at line 4 and eleven, and you aren't properly changing the values to reflect the door's status

Values = game.Workspace.Values.Value
script.Parent.MouseButton1Down:connect(function()
    if Values.OfficeDoorV.Value == "Closed"
        and Values.Obscure.Value == "Visible"
        then game.Workspace.OfficeDoor.DoorFrame.Barrier.Transparency = 0
        game.Workspace.OfficeDoor.DoorFrame.Barrier.CanCollide = true
        Values.OfficeDoorV.Value = "Open"
	Values.Obscure.Value ="Obscure"
        print("Obscure")
    elseif
        Values.OfficeDoorV.Value == "Open"
        and Values.Obscure.Value == "Obscure"
        then game.Workspace.OfficeDoor.DoorFrame.Barrier.Transparency = 1
        game.Workspace.OfficeDoor.DoorFrame.Barrier.CanCollide = false
	Values.OfficeDoorV.Value = "Closed"
	Values.Obscure.Value ="Visible"
        print("Visible")
    end
end

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