Why does my teleport screen also show up on other players screen when I enter a teleporter?

The problem
So my problem is, that when I enter a teleporter, that a teleport screen shows up but it also shows up on other players screen, and that would be annoying for other players. I tried to search for solutions but they are like not for my problem.

The script
ejsf

What I expected
My expectation was that it clearly works, but when I tried it out with the double client, I saw that the teleport screen also appeared on the other players screen, I tried to solve it with local script, but it also didn’t work. I tried to put the gui into the replicated first but it said: “Teleporter is not a valid member of workspace.” I also searched on Youtube to fix that but there were only videos about loading screens.
I searched on the Developer Forum to see if someone also has a problem but I didn’t find one.

The result what would happen
If I run this script it works, but as I said, it also appears on the other player’s screen what would be annoying.

1 Like

Your problem appears to be a misunderstanding of what your script is doing.

Everytime the .Touched event is fired, your function is called - this means if a bullet or anything at all touches the teleport screen, it will call that function. This also means if another player touches this button, your function still fires.

The parameter to your function is “plr”, which I’m assuming you wanted to be the player who touched it. Let’s change it up a bit:

tp.Touched:Connect(function(hit)
    local player = game.Players:GetPlayerFromCharacter(hit.Parent)
    if player and player == game.Players.LocalPlayer then
        gui.Holder --- etc
2 Likes

Server-Client Replication


You should probably change the script to a LocalScript if possible. Otherwise you will have a server-wide GUI if you ran this script in a normal script.

The visuals are fired from server, listening to the remote.

Therefore, you should make the visuals client-sided, if you wanted the teleporting player to gain the GUI and not the server.

Alternative
Not sure, but if you manipulate the GUI from server, try the reply above.

Changing this from a script to a LocalScript won’t affect the functionality. Because there is no filtering or checks for the Touched event, anything that touches the brick is registered as a touch. The only difference is where it’s registered, so clients with the script would receive Touched events and those without it won’t.

Visuals aren’t server-sided at all.

4 Likes

Well thanks, I understand now the issue! :smiley: