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

How do I make local Variables within a function that's specific to a player?

Asked by 5 years ago

So I'm making a door script where the player clicks on one side of a door and would appear on the other side and vice versa, there would also be a GUI transition animation for the player when they click the door and I plan on doing this using RemoteEvents.

local transitioning = false
script.Parent.DoorIn.ClickDetector.MouseClick:Connect(function(Plr)
    if transitioning == false then
        transitioning = true
        --fire said RemoteEvent
        wait(0.5)
        transitioning = false
    end
end)

This just makes it so that the player cannot fire an event whilst the transitioning is occurring, but this means other players cannot activate the transition whilst another player is already transitioning during that 0.5 wait period, I would like other players to click on the door and activate the event despite ANOTHER player is already transitioning.

1
Try putting players in a debounce table, if they are not in the table, put them in and fire the remote event. After firing, remove them from the table. Rheines 661 — 5y
0
Wouldn’t that be taxing on the script performance or would it not affect it? Marmalados 193 — 5y

Answer this question