ProximityPrompt not replicating to server

I did not know exactly what to title this, but here is my problem:

I have a proximity prompt that when fired, it will teleport the player to a certain position, but the player is only teleported on the client.

The strange thing is, that this is in a serverscript, not a localscript. I have tried different things such as firing a bindable event to another serverscript to teleport, but that still only moved the player on the client. Then I tried making a localscript that fires a remote event and the server moves the player, and it still only did it for the client.

Why is this happening?

My current script (local that fires to server):

local enter = game.Workspace.Bunker.BunkerEntrance.PrimaryPart.EnterBunker

enter.Triggered:Connect(function(plr)
	if plr == game.Players.LocalPlayer then
		if plr.Character then
			if plr.Character.Humanoid.Health > 0 then
				game.ReplicatedStorage.Events.BunkerTP:FireServer(true)
			end
		end
	end
end)

local leave = game.Workspace.Bunker.BunkerLeaveHatch.PrimaryPart.ExitBunker

leave.Triggered:Connect(function(plr)
	if plr == game.Players.LocalPlayer then
		if plr.Character then
			if plr.Character.Humanoid.Health > 0 then
				game.ReplicatedStorage.Events.BunkerTP:FireServer(false)
			end
		end
	end
end)

Thanks, Jail.

Boosting this topic, replys would be nice.

Can you show me your server script?

Why do any of this on the client?

Just connect to PromptTriggered on the server and handle the entire thing there. You don’t need to fire an event for this.

1 Like

Read my post. I said that I tried that, and it resulted in the same thing. Then I tried these other ways wondering if that was the issue.

local function OnTP(player, enter)
	if player.Character then
		if enter then
			player.Character.HumanoidRootPart.Position = game.Workspace.BunkerTP.Position
		else
			player.Character.HumanoidRootPart.Position = game.Workspace.BunkerLeave.Position
		end
	end
end

game.ReplicatedStorage.Events.BunkerTP.OnServerEvent:Connect(OnTP)

Try using :MoveTo()

local function OnTP(player, enter)
	if player.Character then
		if enter then
			player.Character:MoveTo(game.Workspace.BunkerTP.Position)
		else
			player.Character:MoveTo(game.Workspace.BunkerLeave.Position)
		end
	end
end

game.ReplicatedStorage.Events.BunkerTP.OnServerEvent:Connect(OnTP)