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

Why isn't my onTouched script working when the script states clearly what to do?

Asked by 4 years ago
Edited 4 years ago

Here is a script that changes transparency and cancollide for a part that is in workspace but the part that needs to be triggered for the part to do this is in a group and I can't seem to get it to work. The part that has to be triggered is called "Remover" and it is in workspace in a group called "Space". And the part that responds to the script is called "Grass" is just in workspace

Remover = script.Parent.Space
Grass = script.Parent.Parent

function onTouched(Part)
    Grass.Transparency = 1
    Grass.CanCollide = nil
    wait(90)
    Grass.Transparency = 1
    Grass.CanCollide = true
end
connection = script.Parent.Touched:connect(onTouched)

Reupload: because this question was unnoticable earlier

0
is that a script or a local script? 0msh 333 — 4y
0
"script" User#30241 0 — 4y
0
Could you add prints and tell me what it prints. BlackOrange3343 2676 — 4y

1 answer

Log in to vote
0
Answered by
Robowon1 323 Moderation Voter
4 years ago
Edited 4 years ago
local Remover = script.Parent.Space:WaitForChild("Remover")
local Grass = script.Parent.Parent

Remover.Touched:connect(function()
 Grass.Transparency = 1
    Grass.CanCollide = false
    wait(90)
    Grass.Transparency = 1
    Grass.CanCollide = true
end

Ad

Answer this question