generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: Bindable Function not firing

Previous Thread :: Next Thread 
zakiack is not online. 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 is not online. 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
spacesplitter is not online. spacesplitter
Joined: 10 Jul 2015
Total Posts: 44
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 is not online. zakiack
Joined: 24 Jul 2013
Total Posts: 3
30 Jul 2017 01:30 PM
Thanks for your help!


Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image