#how could i make this script function when tool gets activated instead of when i click leftclick?
1 messages · Page 1 of 1 (latest)
tool.Activated:Connect
didnt work for me
so what i tried was putting tool.Activated:Connect at game:GetService("UserInputService").InputBegan:Connect(onLeftClick) but it didnt work
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
ok
i tried ```local function test()
print("working)
end
test()``` but it didnt print
i mean
tool.activated:connect(test)
try in a localscript
it is in a local
and theres no errors?
nope
local function test()
print("worked")
end
tool.Activated:Connect(test)``` this the whole script
right tool
everything right
tool in starter pack
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
ok
Sorry for late response someone knocked on the door
now this works
👍
Whats the script?
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
no, now youre just calling the function and when the tool is activated nothing will happen
tool.Activated:Connect(onLeftClick)
without the brackets
i have that now
does it work?
yes
👍
btw how long you have been scripting
wow thats a long time
Time flies