Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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


local tool = script.Parent
local player = game.Players.LocalPlayer
local fired = tool.Activated --when the tool is used
local bullet = game.Workspace.ReplicatedStorage.bullets.arrow --the bullet
local damage = 1 --how much damage the bullet outputs
local cooldown = 1 -- how long before you can fire again
local distance = 15 --how long before the bullet dissapears


function
	bullet:clone().Parent = tool
	tool.arrow.velocity = 150
end


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.

1 answer

✓ Accepted answer

I would check out Friaza Hyuga tutorials, he made some for that topic.

This discussion is preserved as it was. New answers, comments, and votes are closed.