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

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

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

3 comments

0

is that a script or a local script?

0

"script"

0

Could you add prints and tell me what it prints.

1 answer

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

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