Hello guys,
Brief description of the issue
I have a problem with the server side POV after my character has been teleported using remote events.
Local script in button
local button = script.Parent
local TeleportToAreaEvent = game.ReplicatedStorage.TeleportToArea
local debounce = false
button.MouseButton1Down:Connect(function(player)
if not debounce then
game.Players.LocalPlayer.PlayerGui.ScreenGui.TextButton.Text = "Teleported player"
debounce = true
TeleportToAreaEvent:FireServer()
task.wait(1)
game.Players.LocalPlayer.PlayerGui.ScreenGui.TextButton.Text = "Teleport to random area"
debounce = false
end
end)
Server script
local TeleportToAreaEvent = game.ReplicatedStorage.TeleportToArea
local teleporters = game.Workspace.Teleporters:GetChildren()
TeleportToAreaEvent.OnServerEvent:Connect(function(player)
if player then
local HumanoidRootPart = player.Character:FindFirstChild("HumanoidRootPart")
if HumanoidRootPart then
HumanoidRootPart.Position = teleporters[math.random(1, #teleporters)].Position
end
end
end)
Client POV
Server POV