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

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

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.

2 comments

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

0

but they did

1 answer

✓ Accepted answer

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

1 comment

0

I thought that it should work, because I did: "local Player = game.Players.LocalPlayer" in the localscript. Thank you for the solution.

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