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

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

Asked by 6 years ago

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.

0
Basically, this is meant to load the interior of the house to only those who touch it. ExtremeRisk 9 — 6y

1 answer

Log in to vote
0
Answered by
Rare_tendo 3000 Moderation Voter Community Moderator
6 years ago

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)
0
Thank you so much! ExtremeRisk 9 — 6y
Ad

Answer this question