How to make a tool know when it is used and how do you make a proper projectile?
I have been trying to make a bow and arrow that works similar to the generic pew pew gun, where when you click a button it shoots a brick that deals damage on impact. Nothing overly complicated.
However I have no idea how projectiles work as shown by the script below
01 | local tool = script.Parent |
02 | local player = game.Players.LocalPlayer |
03 | local fired = tool.Activated |
04 | local bullet = game.Workspace.ReplicatedStorage.bullets.arrow |
11 | bullet:clone().Parent = tool |
12 | tool.arrow.velocity = 150 |
This was the best I could come up with.
I know you need to have the script detect when the tool is clicked, have it spawn an item, give that item a velocity, then assign damage to that item.
So, how do you make it so a tool knows when it is clicked and how do you make a proper projectile with velocity and damage?
I'd prefer if answers contained minimal scripting but rather just the functions i need and how they work, because I want to make this myself.