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

Event Fired Clinet Parameter is Nil why???

I cannot share the full script due to reasons, but I can tell about the following... I have this main script, a regular script in server script service, which picks a random part from the workspace and it fires to a client by.. Event:FireClient(Player, Part.Position). On the receiving end in another script, a local script in starter character scripts, it connects the function as such...

Event.OnClientEvent:Connect(function(Player, Location)
	Code Here, Not sharing due to reasons...
end)

My problem is that the Location otherwise Part.Position in this local script is nil why is this a nil value instead of the Vector3 Value???

**My spelling or some Syntax may be wrong, but that is the not issue here.

1 answer

✓ Accepted answer

OnClientEvent doesn't have a Player parameter as you can see here. You can get the player from just using game.Players.LocalPlayer since it's a local script. If you try printing 'Player' you'll notice that it will print the Vector3 Value, that's because the part's location is being assigned to 'Player' and 'Location' is going to remain nil because you aren't actually assigning anything to it.

3 comments

0

Ahh that does make sense and Im sure your right but then why need to put player in Event:FireClient(Player, Part.Position)???

1

FireClient will only fire to the specified client. That's why you need the Player in FireClient, because it needs to know which client it will be firing to.

0

Alr, thx for the clarification.

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