Uzil
|
  |
| Joined: 02 Jun 2014 |
| Total Posts: 366 |
|
|
| 18 Jul 2017 03:31 PM |
ok, so inside of a ImageButton I have 3 things: remoteEvent, local script for client, and the script for server.
this is inside the Localscript:
remote = script.Parent.Remote UserInputService = game:GetService("UserInputService")
script.Parent.MouseButton1Click:connect(function() remote:FireServer() end)
this is inside the Script:
script.Parent.Remote.OnServerEvent:connect(function(player) player.Character.Humanoid.Health = 0 end)
I test this in studio and it works, but when I test game mode nothing happens and nothing appears in output. |
|
|
| Report Abuse |
|
|
TimeTicks
|
  |
| Joined: 27 Apr 2011 |
| Total Posts: 27115 |
|
|
| 18 Jul 2017 03:43 PM |
--server script local re = game.ReplicatedStorage:WaitForChild('RemoteEvent') --store in rep storage
re.OnServerEvent:connect(function(plr) local human = plr.Character.Humanoid human.Health = 0 end)
--local script local re = game.ReplicatedStorage:WaitForChild('RemoteEvent') local gui = script.Parent
gui.MouseButton1Click:connect(function() re:FireServer() end)
|
|
|
| Report Abuse |
|
|
Uzil
|
  |
| Joined: 02 Jun 2014 |
| Total Posts: 366 |
|
|
| 19 Jul 2017 11:45 AM |
| For some reason it still doesn't work |
|
|
| Report Abuse |
|
|
|
| 19 Jul 2017 12:01 PM |
Put your event into ReplicatedStorage, your server script in ServerScriptStorage, and other in StarterGui.
|
|
|
| Report Abuse |
|
|
Uzil
|
  |
| Joined: 02 Jun 2014 |
| Total Posts: 366 |
|
|
| 19 Jul 2017 12:21 PM |
| @luka&timeticks, it works, thanks for the help brodies 😎 |
|
|
| Report Abuse |
|
|