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

Roblox: Argument 1 missing or nil when attempting to FireClient() via Server Script?

Hey, I'm pretty new to scripting but, what went wrong with this simple script, I am getting 'Argument 1 missing or nil' Here is the code:

script.Parent.Touched:Connect(function()
	game.ReplicatedStorage.Events.LoadHouseClient:FireClient()
end)

Any help would be appreciated, thanks.

1 comment

0

Basically, this is meant to load the interior of the house to only those who touch it.

1 answer

✓ Accepted answer

The reason is because you're missing an argument for the FireClient method which is supposed to be the player to fire the event to.

script.Parent.Touched:Connect(function(hit)
    local p = game.Players:GetPlayerFromCharacter(hit.Parent)
    if p then
        game.ReplicatedStorage.Events.LoadHouseClient:FireClient(p)
    end
end)

1 comment

0

Thank you so much!

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