Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Error Argument 1 missing or nil when firing a remove event. Can someone help me?

I have the following script in a part that you click: It's a normal script

local lobbyspawns = {game.Workspace.Lobby:WaitForChild("s1").Position,game.Workspace.Lobby:WaitForChild("s2").Position,game.Workspace.Lobby:WaitForChild("s3").Position,game.Workspace.Lobby:WaitForChild("s4").Position}
script.Parent:WaitForChild("ClickDetector").MouseClick:connect(function(player)
	local SavedPlayers = {}
	table.insert(SavedPlayers,player.Name)
	player.leaderstats.Money.Value = player.leaderstats.Money.Value + 250
	repeat wait() until player.Character
	player.Character:WaitForChild("CameraManipulation"):WaitForChild("RoundTheBus"):FireClient() --Error here "Argument 1 missing or nil" >:C
	local n = math.random(1,4)
	player.Character:WaitForChild("HumanoidRootPart").CFrame = CFrame.new(lobbyspawns[n]) + Vector3.new(0,2,0) --Change to vector??
end)

And the following one in a *LocalScript*

script.RoundTheBus.OnClientEvent:connect(function()
	local player = game.Players.LocalPlayer
    local cam = game.Workspace:WaitForChild("Camera")
wait()
---------------
local target = game.Workspace:WaitForChild("Bus"):WaitForChild("TheBus").Focus
local camera = workspace.Camera
camera.CameraType = Enum.CameraType.Scriptable
camera.CameraSubject = target
local angle = 0
 
while wait() do
    camera.CoordinateFrame = CFrame.new(target.Position)  --Start at the position of the part
                           * CFrame.Angles(0, angle, 0) --Rotate by the angle
                           * CFrame.new(0, 10, 15)       --Move the camera backwards 15 units
    angle = angle + math.rad(1)
if script:WaitForChild("RoundThePlayer"):WaitForChild("Fired").Value == true then
	break
end

end
end)

For some reason, everytime I click it it says: *Argument 1 missing or nil* Why does this happen? How do I fix this? P.S: The "*RoundTheBus*" is inside that "*LocalScript*"

1 answer

✓ Accepted answer

RemoteEvent:FireClient() always requires one argument; the player to fire it to. You can easily fix this by doing player.Character:WaitForChild("CameraManipulation"):WaitForChild("RoundTheBus"):FireClient(player)

2 comments

0

player.Character:WaitForChild("CameraManipulation"):WaitForChild("RoundTheBus"):FireClient(player)

0

Ooooooohhhhh.. Thanks a lot player!

This discussion is preserved as it was. New answers, comments, and votes are closed.