Hello! i would like it so that when a player steps on a button (using touch) it would change a variable in a localscript for that player. iv'e used binable events but that did it for all the players and not the one that was on the button. here is the touch code i am using for the button
script.Parent.Touched:Connect(function(hit) if hit.Parent:FindFirstChild("Humanoid") then local plr = game.Players:GetPlayerFromCharacter(hit.Parent) if plr then --set variable to true end end end)
here is the player code
hasPassengers = false
Simply fire a Remote Event:
script.Parent.Touched:Connect(function(hit) if hit.Parent:FindFirstChild("Humanoid") then local plr = game.Players:GetPlayerFromCharacter(hit.Parent) if plr then game.ReplicatedStorage.PlaceHolderforyourEvent:FireClient(plr) end end end)
Inside Player:
hasPassengers = false game.ReplicatedStorage.PlaceHolderforyourEvent.OnClientEvent:Connect(function() hasPassengers = true end)