i made a code that if you have enough points you can go through a door BUT if one person goes through it, other can too and i dont want that i want so the only person that opened that door can go

i made a code that if you have enough points you can go through a door BUT if one person goes through it, other can too and i dont want that i want so the only person that opened that door can go

Change it to a local script and when taking the points off the player, use a remote event so the value is changed on the server side.
OR you can use collision groups!
You could set the achieved character’s collision group and use a collision filter on the door to allow them through.
Here is a sample function to help you along too, when you have collision groups set up like this. when players are added they will be set to Default, call set_player_walkthrough(player) to allow them to walk through even if they respawn. Set the door to trail_door by selecting it in the world and clicking the + button in the collision group editor.

local PhysicsService = game:GetService("PhysicsService")
local function set_character_walkthrough(character: Model)
for _, item: BasePart in character:GetDescendants() do
if item:IsA("BasePart") then
item.CollisionGroup = "walkthrough"
end
end
end
local function set_player_walkthrough(player: Player)
if player.Character then
set_character_walkthrough(player.Character)
end
player.CharacterAdded:Connect(set_character_walkthrough)
end
i dont know what it is but i am learning how to use remoteEvents rn
Just use collision groups they’re easier to set up.
so basically put the code that makes that player go through the door in a local script in startergui inside this function and make a remoteevent in replicatedstorage called OpenDoor
`game.ReplicatedStorage.OpenDoor.OnClientEvent:Connect(function()
code i told you to put here
end)`
to fire this code put this code in the if points.Value >= 5 then block
game.ReplicatedStorage.OpenDoor:FireClient(player)
i dont have time for this today but i will do it tommorow ty for everything i know how it works and i kind of know how to use it so again thank you
maybe you can add an value that contains the player that should pass it, and then make the player humanoidrootpart position front of the part u want like humanroot.CFrame = part.CFrame * CFrame.new(1,0,0) or smth and make it transparent (if it was supposed to) AND make the gate stil cancolide off