local RS = game:GetService("ReplicatedStorage")
local event: RemoteEvent = RS.googoogaga
event.OnServerEvent:Connect(function(player)
local char = player.Character or player.CharacterAdded:Wait()
char:SetPrimaryPartCFrame(CFrame.new(223.612, 12.68, 22.188))
end)
the problem is that you’re only getting the player that triggered the prompt and teleporting that player. I suggest instead using a for loop to loop through the players and then teleporting them all. It would be something like this
local Players = game:GetService("Players")
for _, v in pairs(Players:GetPlayers()) do
v.Character.HumanoidRootPart.CFrame = CFrame.new(223.612, 12.68, 22.188)
end)
also, it might be better to use PivotTo() instead of changing the CFrame of their HumanoidRootPart.
local Players = game:GetService("Players")
for _, v in pairs(Players:GetPlayers()) do
v.Character:PivotTo(CFrame.new(223.612, 12.68, 22.188))
end)
you could use either but I’d use PivotTo() since it can be used to move the entire model in other cases
Actually, the thought completely went through my mind. Why are you teleporting them in the client? It’s probably better to loop through the players and teleport them on the server instead (like what @Bonusizawesome mentioned).
my code didn’t include the proximity prompt. this is not the full code, but an example. I can add the rest of it if you’d like
local Players = game:GetService("Players")
game.ReplicatedStorage.googoogaga.OnServerEvent:Connect(function(player)
for _, v in pairs(Players:GetPlayers()) do
v.Character:PivotTo(CFrame.new(223.612, 12.68, 22.188))
end)
end)
it seems that they are already moving them on the server but using a remotevent to talk to the localscript which listens to when the prompt is triggered. however, this is possibly unneeded and can be handled entirely on the server