Hello everyone, I want to make a system for my future obby, how can I make the player see the keys only for him and once, because I tested the game with my friend and I see how he opens and he, I want me not saw him open the door with a key, maybe someone knows how to help me, please help.
Run a local script which makes the door can collide false and makes it semi transparent if the player has access
I tried it, but after these actions I cannot pick up the key
I don’t under stand what you mean by picking up the key,
You say to put the local script, I did it, but after I put it I can not pick up the key
what did you put in the localscript
now I have a regular script, after I replace it with a local script one, it cannot be picked up later
No, I mean make a new localscript snd put in starterplayerscripts
I tried as you said, but I also cannot pick up the key
Ok I’ll wait from another experienced programmer,
if you want to see only for specific players, use local scripts and some remote events.
create a remote event on the replicated storage
for the normal script, when the player tries to open the door, fire the remote event for that player, but dont open yet.
then on the local script, connect a function that listens for the remote event.
when it fires, open the door
Hmm, I badly understood what you mean
can you send the script of the door thing
When it’s touched, you should get the player from the character and fire the client. When it’s fired you should then connect the local script to the event and destroy the door client side
Didn’t understand anything at all
create a remote event on replicated storage and name it “DoorOpen”
replace the door script with this
local Door = game.ReplicatedStorage.RedDoor:Clone()
Door.Parent = workspace
local RemoteEvent = game.ReplicatedStorage.DoorOpen
Door.Keyhole.Touched:Connect(function(hit)
print("Touched")
local model = hit:FindFirstAncestorWhichIsA("Model")
if not model then return end
local player = game.Players:GetPlayerFromCharacter(model)
if not player then return end
if hit.Name == "Key" and hit.BrickColor == Door.Keyhole.BrickColor then
RemoteEvent:FireClient(player, Door, hit)
else
print("Nope")
end
end)
create a local script on the StarterPlayer > StarterPlayerScripts and paste this
local RemoteEvent = game.ReplicatedStorage.DoorOpen
RemoteEvent.OnClientEvent:Connect(function(Door, hit)
Door:Destroy()
hit:Destroy()
end)
tell me if something goes wrong
Hm, I have some kind of error, do you have a discord?
i updated try again, and yes i have discord
VisualEX#6771 add me in discord, send me a request