Raildex
|
  |
| Joined: 06 Dec 2009 |
| Total Posts: 934 |
|
|
| 12 Mar 2016 04:48 PM |
So what i need to do here is that when a ship dies (my function below), script.Parent.ShipHumanoid.Changed:connect(function() if script.Parent.ShipHumanoid.Health <= 0 then
it will trigger a function in the players gui that will change text, it needs to pass the values script.Parent.Name and script.Parent.Parent.Parent.Name
( the localscript's location is PlayerGui.SideBar.main.Cain <-Cain is the scripts parent)
it needs to then check in the local script in the gui if the second passed value (script.Parent.Parent.Parent.Name) is the same as the script.Parent.Parent.teamName.Value
how do I do this, I know how to go from local to server but not the other way around. |
|
|
| Report Abuse |
|
|
jode6543
|
  |
| Joined: 16 Jun 2009 |
| Total Posts: 5363 |
|
|
| 12 Mar 2016 04:59 PM |
--On the server local remote = game.ReplicatedStorage.SomeRemoteEvent --replace this script.Parent.ShipHumanoid.Changed:connect(function() if script.Parent.ShipHumanoid.Health <= 0 then remote:FireClient(playerReceivingEvent, script.Parent.Name, script.Parent.Parent.Parent.Name) end end)
Or, if you want all players to receive the event: remote:FireAllClients(script.Parent.Name, script.Parent.Parent.Parent.Name)
--On the client local remote = game.ReplicatedStorage.SomeRemoteEvent remote.OnClientEvent:connect(function(name1, name2) --do stuff end)
Also, if you are unaware, you can access the API documentation on the Wiki for pretty much every instance: http://wiki.roblox.com/index.php?title=API:Class/RemoteEvent |
|
|
| Report Abuse |
|
|
Raildex
|
  |
| Joined: 06 Dec 2009 |
| Total Posts: 934 |
|
|
| 12 Mar 2016 05:10 PM |
Yeah I had gone to the Wiki and read through it but I just couldnt grasp it for locals. So if I did remote:FireClient(script.Parent.Parent.Parent.OwnerName.Value, script.Parent.Name, script.Parent.Parent.Parent.Name) it would only go to the local script of the specified player? |
|
|
| Report Abuse |
|
|
jode6543
|
  |
| Joined: 16 Jun 2009 |
| Total Posts: 5363 |
|
| |
|
Raildex
|
  |
| Joined: 06 Dec 2009 |
| Total Posts: 934 |
|
|
| 12 Mar 2016 06:19 PM |
| it didnt work, I found that I need to go it a player object? |
|
|
| Report Abuse |
|
|
Raildex
|
  |
| Joined: 06 Dec 2009 |
| Total Posts: 934 |
|
|
| 12 Mar 2016 06:55 PM |
remote:FireClient(game.Players[script.Parent.Parent.Parent.OwnerName.Value],deathText)
I changed it to that and it works in studio testing but when run on a server it says that it is not a valid member of players? |
|
|
| Report Abuse |
|
|
jode6543
|
  |
| Joined: 16 Jun 2009 |
| Total Posts: 5363 |
|
|
| 12 Mar 2016 07:09 PM |
You'll want to check that the player actually exists first:
local player = game.Players:FindFirstChild(script.Parent.Parent.Parent.OwnerName.Value) if player then remote:FireClient(player, deathText) end |
|
|
| Report Abuse |
|
|