You can see where it says, “HRP.CFrame” right after that it says “(XAxis,”. That comma is highlighted red. Am I doing something wrong with Args, or is it something else?
So basically you need to change this line (line 4) to HRP.CFrame = CFrame.new(X,Y,Z)
since you are setting the CFrame’s XYZ. This might help: CFrame | Documentation - Roblox Creator Hub
@lordmochibi@ArtFoundation@DaBisawesome123. The scripting still didn’t work but there’s a new output: Players.Infuriashon.PlayerGui.RemoteEvents:19: attempt to index nil with ‘CFrame’.
New script:
Rem_Events.TelePlayers.OnClientEvent:Connect(function(X, Y, Z)
HRP.CFrame = CFrame.new(X, Y, Z)
end)
I changed it, but this is what’s happening. Sorry that I couldn’t respond earlier. Didn’t do anything dev related for a day because of Chadwick.
Try adding HRP as the first parameter, and on the server,
-- this should replace the part where they fire the client
for i, v in pairs(game.Players:GetPlayers()) do
if v.Character then -- when a player's about to leave, their character is destroyed.
remoteEvent:FireClient(v, v.Character:WaitForChild("HumanoidRootPart"), X, Y, Z)
end
end
A better solution is not to teleport them from the client, but the server.
function teleportPlayers(availablePlayers, position)
-- teleporting players
for i, v in pairs(availablePlayers) do
if v.Character then
v.Character:WaitForChild("HumanoidRootPart").CFrame = CFrame.new(position) -- converts the position into a CFrame
end
end
end
-- then call teleportPlayers() so they can be teleported
teleportPlayers(game.Players:GetPlayers(), INSERT_VECTOR3.NEW_POSITION_HERE)