Hello, I was making a pistol for my game. And, when I activate the tool, It doesn’t work, and when I checked my output, there wasn’t any errors.
Here’s the script:
local bulletscript = game.ReplicatedStorage.BulletDMG
local debounce = false
local tool = script.Parent.Parent
local bp = script.Parent.Parent.BulletPart
local sound = script.Parent.GunShot
local bullet = game.ReplicatedStorage.Bullet
game.Players.PlayerAdded:Connect(function(plr)
script.Parent.Parent.Activated:Connect(function()
if not debounce then
local mouse = plr:GetMouse()
local bclone = bullet:Clone()
bclone.Parent = workspace
bulletscript:Clone().Parent = bclone
bclone.Position = mouse.Target.Position
bclone.Anchored = true
sound:Play()
debounce = true
if debounce then
wait(5)
debounce = false
end
end
end)
end)