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

Argument 1 missing or nil error, why is it happening?

Asked by 3 years ago

I wrote this script, as an attempt to make one of my AI's chat, when clicked. I used a remote function to make it client sided, instead of serversided, and I keep getting an error from the click script saying 'Argument 1 missing or nil' Here's the script:

script.Parent.MouseClick:Connect(function(player)
    if player:WaitForChild("PlayerGui").StoreGUI.Enabled == true then
        player.PlayerGui.StoreGUI.Enabled = false
    else
        script.Speak:FireClient()
        wait(8)
        player.PlayerGui.StoreGUI.Enabled = true
    end
end)

1 answer

Log in to vote
3
Answered by 3 years ago

You are doing script.Speak:FireClient() without specifying which client.

Do script.Speak:FireClient(player)

0
Thanks. I'll try it. MrOinkerzYT 87 — 3y
0
Sorry for a delayed response. If it works, I'll accept it. MrOinkerzYT 87 — 3y
Ad

Answer this question