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

Player only wall won't work, It keeps forcing players to not enter, why the hell Is that?

This is just dumb, I made a wall that won't let NPCS go through but only players does but It keeps working players to not enter! Its just dumb!

Script:

script.Parent.Touched:Connect(function(Hit)
	local Player = game:GetService("Players"):GetPlayerFromCharacter(Hit.Parent)
	
	if Player then
		script.Parent.CanCollide = false
	else
		script.Parent.CanCollide = true
	end
end)

1 answer

try changing your script to this

script.Parent.Touched:Connect(function(Hit)
    local Player = game.Players:FindFirstChild(Hit.Parent.Name)

    if Player then
        script.Parent.CanCollide = false
    else
        script.Parent.CanCollide = true
    end
end)

maybe this will work

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