Barrier is not a valid member of Workspace "Workspace"

  1. What do you want to achieve? I want to make it so the script is able to find a part, so I can make the function work

  2. What is the issue? The script is not able to find the part

My script:
game.Workspace.barrier.Touched:Connect(function(hit)
if hit:FindFirstChild(“Humanoid”) then
wait(2)
winnerIndex = true
print(“Player is now in winnerIndex”)
end
end)
image

The only thing that fixed it (I think) is moving it from ClientUI to workspace
image

1 Like

maybe?

game.Workspace:FindFirstChild('barrier')
2 Likes

Or use waitforchild instead of findfirstchild?

1 Like

yeah that too

character limit

2 Likes

Local scripts aren’t able to immediately obtain physical parts in Workspace. You’re going to have to wait for the barrier:

workspace:WaitForChild("Barrier")
2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.