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

Can someone help me with this error I am getting in this script? "Argument 1 missing or nil"

Asked by 4 years ago

Hello. I have this script that is supposed to reset the GUI on spawn. I know there is something called "ResetOnSpawn" but this doesn't work in this situation. I am new to roblox scripting, so if this is a stupid question thats why.

Here is my Server script:

script.Parent.ResetGuiSpawn.OnServerEvent:Connect(function(Player) 
    Player.CharacterAdded:Connect(function(Char)
        Char.Humanoid.Died:Connect(function()
        wait(5);
            script.Parent.ResetGuiSpawn2:FireClient() -- This is where it says the error is
        end)
    end)
end)

-- The remoteevent activates when someone clicks a button on a GUI

Here is my local script:

script.Parent.ResetGuiSpawn2.OnClientEvent:Connect(function()
    Player.PlayerGui.ChangeTeamGui.Enabled = true
end)

Any help would be appreciated.

0
idk the script, but im typing this comment to give you a notification so that you will think that someone actually answered your question lolol 10x31x2019 -6 — 4y
0
but they did peter21340 41 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

Try this code:


script.Parent.ResetGuiSpawn.OnServerEvent:Connect(function(Player) Player.CharacterAdded:Connect(function(Char) Char.Humanoid.Died:Connect(function() wait(5); script.Parent.ResetGuiSpawn2:FireClient(Player) -- This is where it says the error is end) end) end) -- The remoteevent activates when someone clicks a button on a GUI
0
I thought that it should work, because I did: "local Player = game.Players.LocalPlayer" in the localscript. Thank you for the solution. peter21340 41 — 4y
Ad

Answer this question