Teleporting Character with RemoteEvents but only client can see it

I got some issues with teleporting characters to a part.

Video: https://gyazo.com/4d7b5b9eb33f9ce66b60bfe553ab349c

Scripts below

Server Script

game.ReplicatedStorage.Events.TeleportChar.OnServerEvent:Connect(function(p,ws)
	ws.HumanoidRootPart.Position = workspace.Random.Position
end)

Client Script

game.ReplicatedStorage.Events.TeleportChar:FireServer(ws)

Any ideas why this happens? :confused:

the variable “ws” is the character of the dummy.

What data is the variable ‘ws’ holding?

The character.

30charrrrrrrrrrrrrrrrr

Try getting the character directly from the player object.

game.ReplicatedStorage.Events.TeleportChar.OnServerEvent:Connect(function(Player)
	Player.Character.HumanoidRootPart.Position = workspace.Random.Position
end)

I’m not trying to get myself teleported, im trying the dummy get tp, which is not a player.

Are you getting any errors in the output?

Output empty.

image

Ignore the “false”.

30char

Can I see a screenshot of your explorer?

1 Like

Sure i guess.

image

I think you’re using the wrong event name because I don’t see a ‘TeleportChar’ event in your events folder.

I edited it after to see if it was the name, it wasn’t.

Hmm, ok. I’m gonna try and replicate your code. Give me a sec.

1 Like

Because the dummy is close to you, the engine gave you, the client, network ownership of the dummy, so physics is calculated on your client is sent over to the server. I would assume that the server didn’t see the change because you, the client, still have network ownership of the dummy and its position was updated on the server. You should probably try giving the server network ownership of the dummy before teleporting and see the results:

game.ReplicatedStorage.Events.TeleportChar.OnServerEvent:Connect(function(player, ws)
    ws:SetNetworkOwner(nil)
    -- teleport
end)

Though, when it is far away from you, the network owner is set to the server and the physics will be updated on the server, but who knows, probably worth trying

1 Like

How i’m supposed to SetNetworkOwner on a Model?

You cannot SetNetworkOwner the HumanoidRootPart, since it’s anchored.

You didn’t mention that the HumanoidRootPart was anchored (why is it even anchored)? If you can’t call SetNetworkOwner on a model, you can loop through it’s descendants, check to see if it’s a BasePart, then call the function

1 Like

Try using ws:MoveTo() or ws:SetPrimaryPartCFrame() instead of ws.HumanoidRootPart.Position.

I think, since you’re just moving the primary part, a built-in localscript is automatically moving the rest of the model to the root. You can test this via the ‘Clients and Servers’ section of the Test tab in Studio.

1 Like

Holy crap, thanks, i guess it was that all the time. :smiley:

Lol, guess I was too late.

You can still check out the uncopylocked place I made here:

1 Like