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

Door being unlocked for all the clients, but not the server itself?

Asked by 3 years ago

I made a key and a door script. I'm using a local script that is in StarterPlayerScripts. But, when the key touches the door. It works fine, the only issue is that it unlocks for everyone. Making it so everyone can walk through the door. And also not only that, the server sees the door itself as closed.

local SPS = script.Parent
local here = game.Workspace["House!"].Diningroom.Door

local function touch(p)

        if p.Parent.Name == "Key1" then
            here.Transparency = 0.5
            here.CanCollide = false
            end
end

here.Touched:Connect(touch)

So does that mean I would need to use something like a remote event, so it can fire on one client instead on all of them?

2 answers

Log in to vote
0
Answered by 3 years ago
Edited 3 years ago

Everything you need to know is right here: Collision Filtering Team Doors

0
So would that mean, if a player had a key. It would still work? yayimstrongforever 0 — 3y
0
Or a tool/gear in this case yayimstrongforever 0 — 3y
0
Never mind, I figured out to use it. Thanks! yayimstrongforever 0 — 3y
Ad
Log in to vote
0
Answered by 3 years ago

You can try doing OnClientEvent using a RemoteEvent here is an example:

RemoteEvent.OnClientEvent:Connect(function(returnedData)
    --put your door script lines in here
end)

hope this helps! Keep noted that i'm NOT good at remote events so this is just an Attempt in helping.

0
Alright, I'll be sure to try this out tomorrow. And if it doesn't work, thanks anyway and I'll try SteelMettle1's idea and learn about collision filtering yayimstrongforever 0 — 3y

Answer this question