Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 7 years ago

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)
0
This is in a local script sorry forgot to add that arrowman888 69 — 7y

1 answer

Log in to vote
0
Answered by
Master_JJ 229 Moderation Voter
7 years ago

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

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 arrowman888 69 — 7y
0
Are you testing it online? Master_JJ 229 — 7y
Ad

Answer this question