Players.Infuriashon.PlayerGui.RemoteEvents:19: Expected ')' (to close '(' at column 15), got ','

Making Camping copy for scripting knowledge. You didn’t ask whoops lol.

I am firing a Remote event.

Local Script

local HRP = char:FindFirstChild("HumanoidRootPart")

Rem_Events.TelePlayers.OnClientEvent:Connect(function(XAxis, YAxis, ZAxis)
	HRP.CFrame = (XAxis, YAxis, ZAxis)
end)

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?

When assigning a variable or property, it expects a single value but you are attempting to provide multiple values (a tuple).

You are also trying to assign CFrame so naturally, it will expect a CFrame value, which you have to utilize the CFrame.new constructor for.

2 Likes

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.

Oh?
You didn’t define HRP.

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)

You could try using CFrame.new(Vector3.new(XAxis, YAxis, ZAxis))
Also you could just send the Vector3 object instead of each Axis by doing this

Rem_Events.TelePlayers.OnClientEvent:Connect(function(Position)
	HRP.CFrame = (Position)
end)

and on the event firing side

Event:FireClient(YOUR_CLIENT, Vector3.new(XAxis, YAxis, ZAxis))
1 Like

He defined HRP in the first line, local HRP = char:FindFirstChild("HumanoidRootPart')

1 Like

Oh!

Then the error must be that HRP is nil.

Because :FindFirstChild() can return nil if the child doesn’t exist.

Try :WaitForChild("HumanoidRootPart").

I defined HRP in the top of the script but I didn’t send it in.