|
| 27 Feb 2017 09:46 PM |
| I'm trying to get a better grasp on FireClient and how to pass arguments through that to change a players gui based on a server touched event. Every time I use ########lients: then it works but just FireClient doesn't work. Any idea? |
|
|
| Report Abuse |
|
|
|
| 27 Feb 2017 09:49 PM |
the first argument of fireclient is the player then whatever you're trying to pass to the client
you need to define player first though
for example yourevent:FireClient(player,var) |
|
|
| Report Abuse |
|
|
|
| 27 Feb 2017 09:51 PM |
I did do that.. Gives error in the OnClientEvent function saying player is nil
local ev = game.ReplicatedStorage:WaitForChild("GUIMessage") script.Parent.Touched:connect(function(hit) local player = game.Players:GetPlayerFromCharacter(hit.Parent) if(player) then ev:FireClient(player) end end) |
|
|
| Report Abuse |
|
|
|
| 27 Feb 2017 09:52 PM |
local script..
local gui = script.Parent:WaitForChild("TextLabel")
local guiMessage = game.ReplicatedStorage:WaitForChild("GUIMessage")
guiMessage.OnClientEvent:connect(function(player)
gui.Text = player.Name end) |
|
|
| Report Abuse |
|
|
|
| 27 Feb 2017 09:54 PM |
| print player then tell me what happens |
|
|
| Report Abuse |
|
|
|
| 27 Feb 2017 09:55 PM |
| prints nil These events confuse me lol Because when I switch it to ########lients it works but obviously I just want it for the single client. |
|
|
| Report Abuse |
|
|
|
| 27 Feb 2017 09:57 PM |
local player = game.Players:GetPlayerFromCharacter(hit.Parent) this is the problem then are you using some sort of morph when touching the part? |
|
|
| Report Abuse |
|
|
|
| 27 Feb 2017 09:58 PM |
Nothing absolutely nothing
i'm just in a blank game with a part with a script in it.. and then a gui that is given to a player on enter. |
|
|
| Report Abuse |
|
|
|
| 27 Feb 2017 09:59 PM |
| Was just figuring out how to pass information to a player's gui based on a touched event by him. |
|
|
| Report Abuse |
|
|
| |
|
|
| 27 Feb 2017 10:29 PM |
| Why can't you pass arguments to the client? |
|
|
| Report Abuse |
|
|
Soybeen
|
  |
| Joined: 17 Feb 2010 |
| Total Posts: 21462 |
|
|
| 27 Feb 2017 11:05 PM |
| ### can with RemoteEvents/Functions |
|
|
| Report Abuse |
|
|
Wrathsong
|
  |
| Joined: 05 Jul 2012 |
| Total Posts: 22393 |
|
|
| 27 Feb 2017 11:55 PM |
| ### can pass arguments to the client. In your localscript, your problem is that you're putting the player as an argument of OnClientEvent. You have to specify the player you're firing to in FireClient, but in OnClientEvent, the player isn't an argument because you're in a localscript so you already have the player. OnClientEvent has no arguments unless you specify them. http://wiki.roblox.com/index.php?title=API:Class/RemoteEvent/OnClientEvent Hence its arguments being 'variant'. Ever wanted to learn how to script? Check out my YouTube channel: youtube.com/austintheslayer Want to see me code in action? Follow me on twitch: twitch.tv/austinrblx |
|
|
| Report Abuse |
|
|
Wrathsong
|
  |
| Joined: 05 Jul 2012 |
| Total Posts: 22393 |
|
|
| 27 Feb 2017 11:55 PM |
IT CENSORED 'YOU' WHAT
Ever wanted to learn how to script? Check out my YouTube channel: youtube.com/austintheslayer Want to see me code in action? Follow me on twitch: twitch.tv/austinrblx |
|
|
| Report Abuse |
|
|
Soybeen
|
  |
| Joined: 17 Feb 2010 |
| Total Posts: 21462 |
|
| |
|
|
| 02 Mar 2017 12:10 PM |
I realized the whole time I forgot to add the extra player in the arguments. (Slap face)
|
|
|
| Report Abuse |
|
|