Hello!
I am creating a kiosk/purchasing thing, and I want it to be able to detect the player who clicks on the start screen, and only let them press buttons until they have finished using the kiosk. This way so that trollers cannot just come along and spam click buttons and mess up the screen while someone is genuinely trying to use it.
How would I go about that?
At the moment, all scripts that make the kiosk work are in workspace.
2 Likes
If you make it client side this shouldn’t be a problem. Any inputs the player makes will be unique to their experience, and other players would be unable to affect that.
Otherwise if you wanted to lock the kiosk so that others could see what they’re ordering you could make a simple debounce system where if the kiosk is being used it is then locked from use by other players.
if playerUsing == Player.Name or playerUsing == nil then
playerUsing == Player.Name
If the player finishes their order or if they haven’t made an input after a given amount of time the debounce value could then revert back to nil.
2 Likes
You can put a bool value inside the player
-- Put a script in server script service
game.Players.PlayerAdded:Connect(function(player)
local clickedOnce = Instance.new('BoolValue')
clickedOnce.Parent = player
clickedOnce.Name = "Clicked_Once"
end)
and then you can check if this value is not true inside the part
--Put the script inside the click detector
script.Parent.MouseClick:Connect(function(PlayerWhoClicked)
if PlayerWhoClicked.Clicked_Once.Value == false then
PlayerWhoClicked.Clicked_Once.Value = true
print('clicked')
--Your functions here
end
end)
1 Like