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

Help with this player name situation?

Asked by
G2FU 9
4 years ago

Hello again. I'm still making my troll game and I tried to make this thing where a message told that when a player goes over a pad, it'll say "[USERNAME] is now admin!". I got it to work, but when ever there are multiple people in the game, the game displays all the players names in the message, not just the one that went on. I want to know if there was a way to only display the name of the player who went on only.

This is the script (for when a player touches the pad it will fire a remote event)

game.ReplicatedStorage.wowbro.OnServerEvent:connect(function(player)
local msg = Instance.new("Message")
msg.Parent = Workspace
msg.Text = player.name.." is now admin!"
wait(3.5)
msg:Remove()
end)

This is the local script:

local debounce = false
local p = game.Workspace.Part
p.Touched:connect(function(brbr)
if not debounce then
debounce = true
game.ReplicatedStorage.wowbro:FireServer()
wait(9999999999)
debounce = false
end
end)

and here is the problem that is happening (if above was confusing) https://imgur.com/9vTU7M3

(Keep in mind that I do want all players to see the message, that's why I used a remote event) Any advice would be appreciated!

0
I suggest you just check for the touch on the server and skip the event. The problem is because both clients are listening for the touch and both clients are firing the server event. Meaning the connected function is being called with both players as the player argument. There is no check of who or what touched it (and this should be done serverside anyways). gullet 471 — 4y
0
The script you are showing us will not have this behavior. There is something else in your place conflicting or generating the extra messages. EmilyBendsSpace 1025 — 4y

Answer this question