Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 7 years ago
Edited 7 years ago

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

01local 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}
02script.Parent:WaitForChild("ClickDetector").MouseClick:connect(function(player)
03    local SavedPlayers = {}
04    table.insert(SavedPlayers,player.Name)
05    player.leaderstats.Money.Value = player.leaderstats.Money.Value + 250
06    repeat wait() until player.Character
07    player.Character:WaitForChild("CameraManipulation"):WaitForChild("RoundTheBus"):FireClient() --Error here "Argument 1 missing or nil" >:C
08    local n = math.random(1,4)
09    player.Character:WaitForChild("HumanoidRootPart").CFrame = CFrame.new(lobbyspawns[n]) + Vector3.new(0,2,0) --Change to vector??
10end)

And the following one in a *LocalScript*

01script.RoundTheBus.OnClientEvent:connect(function()
02    local player = game.Players.LocalPlayer
03    local cam = game.Workspace:WaitForChild("Camera")
04wait()
05---------------
06local target = game.Workspace:WaitForChild("Bus"):WaitForChild("TheBus").Focus
07local camera = workspace.Camera
08camera.CameraType = Enum.CameraType.Scriptable
09camera.CameraSubject = target
10local angle = 0
11 
12while wait() do
13    camera.CoordinateFrame = CFrame.new(target.Position)  --Start at the position of the part
14                           * CFrame.Angles(0, angle, 0) --Rotate by the angle
15                           * CFrame.new(0, 10, 15)       --Move the camera backwards 15 units
View all 22 lines...

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

Log in to vote
2
Answered by 7 years ago

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)

0
player.Character:WaitForChild("CameraManipulation"):WaitForChild("RoundTheBus"):FireClient(player) creeperhunter76 554 — 7y
0
Ooooooohhhhh.. Thanks a lot player! wilsonsilva007 373 — 7y
Ad

Answer this question