Function not being picked up

It isn’t printing for some reason.
I asked a roblox dev discord for some help but they couldn’t fix the bug.

local tool = script.Parent

tool.Activated:Connect(function()
print(“Fire”)
end)

you cannot use local functions. remove the local keyword.

fireServer() remains local to the script, so attempting to connect it to a seperate scope will not do anything. if you don’t plan on using a seperate function i suggest for you to just do what @plootus did.

Does the tool have a handle? If not, disable the RequiresHandle property in the tool

Unless Im dumb, you can use the local keyword when defining a function, as when they connect the function and define the function are both in the same scope.

I also tested it like this:

local tool = script.Parent

local function Fire()
	print("Fire")
end

tool.Activated:Connect(Fire)

and it works just fine so I dont think thats the issue.


any who back to the main problem at hand,

My guess is that its most likely a cause of the tool, something about it being setup wrong.

Such as it doesnt have a handle, and the RequiresHandle property is true as @Arismendy0407 mentioned.

So seeing the explorer and how you have everything setup and an image of the properties of the tool would be most appreciated!

1 Like

ВАЙБКОДЕР ВЕЛИКИЙ БОЙЛЕРПЛЕЙТЕР. Да есть.

Tool.Activated fires when you Mouse1 with the tool equipped. It should work regardless of whether it’s in a LocalScript or Script. How are you testing the script? Is the script enabled?

fireserver is FireServer, and that is a command name..

That is just like trying to do:

function print()
-- and you know this isn't going to work
end

You could state _fireserver or anything but a command name.

lets normalize telling each other why we’re wrong rather than just saying off-topic things like this

also i agree with @FroDev1002, my conclusion was wrong so it is definitely the RequiresHandle property.

1 Like

Requires handle is off, I checked multiple times

I used camelcode, but good point anyhow

then it should work. @TheeDeathCaster is correct since it should be working regardless of the script environment. are you sure there isn’t anything else that could be interrupting this?

1 Like

That’s exactly the problem, I look at tutorials and documentation and all that jazz and It looks identical to my code but for some reason it isn’t printing or it’s giving me a big-ole error message.

in that case can we see all of the properties of the tool along with the tool inside of the explorer?

well your style for writing variable names and function names doesnt effect the code so I didnt think it mattered :sob:

1 Like

Just better for origination purposes so I don’t get the functions mixed up.

Give me a second on properties thing

1 Like

Name = TestTool
Parent = StarterPack
All transforms is at 0, 0, 0
Same with pivot
Scale = 1
CanBeDropped = false
ManualActivationOnly = true
ModelStreamingMode = Default
RequiresHandle = false
Enabled = true
Anything I didn’t mention is on default settings.
Phew……. ……..that was tedious

alright! So the cause of this issue appears to be that you have ManualActivationOnly enabled.

I went ahead and tested my code again, and with it on it wouldnt work!
So yeah, disable it and you should be good to go!

2 Likes

IT WORKED

But still why did ManualActivation not work with tool.Activate when it’s description is that it only works with tool.activate

It’s almost like Roblox studio is overstuffed with almost useless features built up over 2 decades…
…or smt idk.

1 Like

Ok so what I gathered from the documentation is that as the name suggests, it has to be activated manually by calling Tool:Activate(), so if for whatever reason you didnt want you tools to be activated by clicking or when a mobile user taps on screen, you would enable this property and would now have to manually trigger it.

the docs in question cause they probably explain it better
https://create.roblox.com/docs/reference/engine/classes/Tool#ManualActivationOnly

4 Likes