#how could i make this script function when tool gets activated instead of when i click leftclick?

1 messages · Page 1 of 1 (latest)

bronze adder
#

script:

#

1 sec

civic hollow
#

tool.Activated:Connect

bronze adder
#

didnt work for me

#

so what i tried was putting tool.Activated:Connect at game:GetService("UserInputService").InputBegan:Connect(onLeftClick) but it didnt work

civic hollow
#

thats not how connections work

#

when you connect it once it stays until you disconnect it

#

connect the tool.Activated to a function and try printing something

bronze adder
#

ok

#

i tried ```local function test()
print("working)
end

test()``` but it didnt print

#

i mean

#

tool.activated:connect(test)

civic hollow
#

try in a localscript

bronze adder
#

it is in a local

civic hollow
#

and theres no errors?

bronze adder
#

nope

civic hollow
#

is it the right tool youre activating?

#

and not a clone or something like that

bronze adder
#

local function test()
    print("worked")
end

tool.Activated:Connect(test)``` this the whole script
#

right tool

#

everything right

#

tool in starter pack

civic hollow
#

There is a property in tools called “RequiresHandle” and if thats true and there is no part in it called “Hitbox” it will not work

#

Try disabling it

bronze adder
#

ok

civic hollow
#

Sorry for late response someone knocked on the door

bronze adder
#

np

#

i disabled it

civic hollow
#

👍

bronze adder
#

im trying it on hitbox now

#

uhhhhhh

civic hollow
#

Whats the script?

bronze adder
#

1 sec

civic hollow
#

when you say onLeftClick() youre actually calling the function

#

remove the brackets

#

tool.Activated:Connect(onLeftClick)

#

and since ur calling the function and it doesnt return anything, that might as well be nil

#

but if you just give it "onLeftClick" it will give it the actual function to call when the tool is activated

#

also, tool.Activated is a signal and not a boolean

#

which means that

if tool.Activated then

end

wont work as you expect

bronze adder
#

oh

#

so i change the end thingy to this ?

civic hollow
#

no, now youre just calling the function and when the tool is activated nothing will happen

#
tool.Activated:Connect(onLeftClick)
#

without the brackets

bronze adder
#

i have that now

civic hollow
#

does it work?

bronze adder
#

yes

civic hollow
#

👍

bronze adder
#

ty again

#

you helped me a lot these days

civic hollow
#

No problem

#

Always happy to help

#

😁

bronze adder
#

btw how long you have been scripting

civic hollow
#

Well

#

I think I started scripting on roblox about 3-4 years ago

bronze adder
#

wow thats a long time

civic hollow
#

Time flies