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

Whats wrong with this door?

The output says" Workspace.Door.Script2:3: attempt to call method 'Touched' (a userdata value)" I don't know what I'm doing wrong

door = game.Workspace.Door
if game.Workspace.Door.Touched() then 
	
	
	door.CanCollide = false
		for i = 0.5, 1, 0.1 do
			door.Transparency = i
			wait ()
		end
		
		for i = 1, 0.5, -.1 do
			door.Transparency = i
			wait ()
		end
		door.CanCollide = true
		
	
end

1 comment

1 answer

The Touched event can be called on with a function not an if statement. Use this instead:

door = game.Workspace.Door

door.Touched:connect(function()
    door.CanCollide = false
        for i = 0.5, 1, 0.1 do
            door.Transparency = i
            wait ()
        end

        for i = 1, 0.5, -.1 do
            door.Transparency = i
            wait ()
        end
        door.CanCollide = true


end)

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