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

Script won't work in Play?

It works when I go to Play Solo mode, but when I press Play, the script won't work. I know that it has no mistakes but why won't it work?

H = game.Workspace.Door

function onTouch(Door)
H.Transparency = 0.5
H.CanCollide = false
wait(5)
H.Transparency = 0
H.CanCollide = true
end

script.Parent.Touched:connect(onTouch)

1 comment

0

Question is Line 11. What is the door touching or vise versa? Because by pressing "play" in studio it runs scripts but wont load the character. Therefore having no object to touch the door.

2 answers

script.Parent.Touched:connect(function(hit)
	local h = game.Workspace.Door
	h.Transparency = .5
	h.CanCollide = false
	wait(5)
	h.Transparency = 0
	h.CanCollide = true
end

Not sure if that will help, but try it out.

If it doesn't work, comment.

2 comments

0

Do I put this in a LocalScript?

0

No...

That is an (onTouch) script, so when you click "Run" there's no character to touch the door. So therefore if you test it in "Solo Mode" it will work because a character is in the game touching the door.

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