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

How do you fix the OnTouched is not a valid member function?

local part = script.Parent

part.OnTouched:connect(function(Plr)
	Plr.PlayerGui.BlackScreenGui:WaitForChild("BlackScreen").BackGroundTransparency = 0
end)

The error I get: OnTouched is not a valid member of UnionOperation 15:05:07.227 - Stack Begin Line: Script 'Workspace.HouseDoor.OuterPart.Script', Line 3 The UnionPart is inside a model

Any other questions please pot in comment section

1 comment

2

Use Touched.

1 answer

✓ Accepted answer

Fixed script:

local part = script.Parent

part.Touched:connect(function(Plr) -- Use Touched, not OnTouched
    Plr.PlayerGui.BlackScreenGui:WaitForChild("BlackScreen").BackGroundTransparency = 0
end)

1 comment

0

I will test it out!

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