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 6 years ago
Edited 6 years ago

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

Log in to vote
2
Answered by 6 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 — 6y
0
Ooooooohhhhh.. Thanks a lot player! wilsonsilva007 373 — 6y
Ad

Answer this question