NOTE: I am aware that this probably does not follow the community guideline of own work; and I apologize for that. If this is going to be moderated, please comment to notify me so I can instead delete the post. I am asking here because I cannot find a guide for this anywhere; not on YouTube, wiki.roblox.com, nor Google in general—there is no tutorial I can find on the web regarding my question.
So I'm just messing around and turning ROBLOX sets weapons into what are basically makeshift machine guns/full auto weapons.
I want a weapon (more specifically, a slingshot) to fire repeatedly until (wink) the player releases LMB; when the tool deactivates.
However. that would mean listening to an event (the Deactivated event) to stop the repeat, and from my past experience, nada (that don't work)
So, how do I achieve this?
This is basically what I'm trying to achieve:
-- everything else in a slingshot above
Tool.Enabled = true
function onActivated()
if not Tool.Enabled then
return
end
Tool.Enabled = false
local character = Tool.Parent;
local humanoid = character.Humanoid
if humanoid == nil then
print("Humanoid not found")
return
end
local targetPos = humanoid.TargetPoint
-- here it is
repeat
fire(targetPos)
until Tool.Deactivated -- the part that probably won't work
wait(1)
Tool.Enabled = true
end
script.Parent.Activated:connect(onActivated)

2 comments
That isn't what the Deactivated event does.
??? What do you mean?