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

Script won't work in Play?

Asked by 10 years ago

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)
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. Orlando777 315 — 10y

2 answers

Log in to vote
0
Answered by 10 years ago
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.

0
Do I put this in a LocalScript? bloonblaster2000 55 — 10y
0
No... systematicaddict 295 — 10y
Ad
Log in to vote
0
Answered by 10 years ago

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.

Answer this question