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

Is there a way to make CanCollide go off for only one player?

I tried a bunch of different ways but no matter what I try CanCollide always goes off for all the players is there a way to make it just one player?

local h1 = game.Workspace.Kingdom.Hidden1
local h2 = game.Workspace.Kingdom.Hidden2

function onTouch(hit)
	if hit.Parent:findFirstChild("Humanoid") then
        h1.CanCollide = false
        h2.CanCollide = false
	end
	end
game.Workspace.Kingdom.Carpet.Touched:connect(onTouch)

1 comment

0

This is in a local script sorry forgot to add that

1 answer

One trick to make a part CanCollide for only one player is to turn on FilteringEnabled, something roblox made to prevent hacking. To enabled this feature click Workspace in the explorer and enabled FilteringEnabled. Then set CanCollide to false in a Local Script of that player.

Just remember that enabling FilteringEnabled, it may interfere with other scripts in your game that don't use remote events or remote functions to communicate with the server and client.

Remote Functions and Events

2 comments

0

Is there a certain place I shoould put it I tried putting it in StarterPlayerScripts, but it still did it for more than 1 player

0

Are you testing it online?

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