zakiack
|
  |
| Joined: 24 Jul 2013 |
| Total Posts: 3 |
|
|
| 30 Jul 2017 11:44 AM |
I put this code in a local script for a gun:
mouse = game.Players.LocalPlayer:GetMouse() local plr = game.Players.LocalPlayer script.Parent.Activated:connect(function() print("Activated") if mouse.Target then print("Target") script.Parent.Shot:Fire(mouse.Target) end end)
Here is the code for a script that recives the function:
script.Parent.Shot.Event:connect(function(target) print("Fired") local h = target.Parent:FindFirstChild("Humanoid") if h then h.Health = h.Health - 20 end end)
When I press play in ROBLOX Studio everything works fine and in my output I get:
Activated Target Fired
But when I play it in a local server my output looks like:
Activated Target
Please help me to figure out what's going on.
- zakiack
|
|
|
| Report Abuse |
|
|
PuddyTats
|
  |
| Joined: 03 Apr 2008 |
| Total Posts: 79351 |
|
|
| 30 Jul 2017 11:46 AM |
You have to use a RemoteEvent here. It's firing the event locally and listening for it on the server, but the server one's never actually being fired.
- |
|
|
| Report Abuse |
|
|
|
| 30 Jul 2017 12:56 PM |
| Well, BindableFunction is used when returning a value, if you just want a script to connect to another script that should fire use BindableEvent, also, BindableFunction uses a callback |
|
|
| Report Abuse |
|
|
zakiack
|
  |
| Joined: 24 Jul 2013 |
| Total Posts: 3 |
|
| |
|