I have this script which clones a stored object then launches it out of a tool. However it does not work. it returns with no errors and a simple printing test shows that it just stops at line 5 when the item is loaded and then doesn't do anything else. I have tried the script in both regular and local script types to the same result. I have some other scripts in my game that clone stuff using a local script from the replicated storage without first getting the replicated storage service that are very similar to what I've done below to get 'arrow'.
local tool = script.Parent local player = game.Players.LocalPlayer local mouse = player:GetMouse() local bullet = game.ReplicatedStorage.bullets.arrow --it stops here function pew() --doesn't do anything in here local arrow = bullet:clone() --all items are properly named and in the correct area arrow.Parent = tool game:GetService("Debris"):AddItem(arrow, 2) arrow.CFrame = CFrame.new(tool.Handle.Position, mouse.Hit.p) local v = Instance.new ("BodyVelocity", arrow) v.velocity = arrow.CFrame.lookVector *90 v.maxForce = Vector3.new(math.huge, math.huge, math.huge) end tool.Activated:connect(pew)
The only thing I can think of is that 'tool.Activated' isn't like a click detector, but I don't really have any simple ideas to get the tool to detect when you click with it in hand. I've determined this from how the arrow should at the very least spawn when I click with the tool.
Any ideas how to fix this?
Your problem is you have ManualActivationOnly
checked, this means mouse clicks will not fire Activated.