Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Tool shooting when I'm not holding it, why is it shooting even with an Equipped function?

Asked by 2 years ago
Edited 2 years ago

Here's my script I was trying to get it to only shoot when I hold it out but it continues to shoot anyways


local Part = game.ReplicatedStorage.Fireball local Tool = script.Parent local Players = game:GetService("Players") local Player = Players.LocalPlayer local Mouse = Player:GetMouse() script.Parent.Equipped:Connect(function() Mouse.Button1Up:Connect(function() local partclone = Part:Clone() local PlayerPos = Player.Character.HumanoidRootPart.Position partclone.CFrame = Tool.Handle.CFrame local Vel = Instance.new("BodyVelocity",partclone) Vel.P = Vector3.new(100000,100000,100000) Vel.Velocity = Mouse.Hit.LookVector * 100 partclone.Parent = game.Workspace end) end)

If you know a fix, send it please.

1 answer

Log in to vote
0
Answered by 2 years ago

So I see one thing that's wrong with this. I don't do guns but I know it's supposed to shoot when the mouse it down not up. Just change line 7 to this.

Mouse.Button1Down

Also, before posting, look on the DevHub then DevForum before coming here. Also, look at this. It has some good information for what you're doing.

Ad

Answer this question