im making a fps game, i have this part called “bullethole” that follows the tip of the gun, but it does this???
the bright red part is the bullethole, it moves down even though it’s suppose to follow the tip of the gun. and the part is anchored it just moves down for no reason???
here is the script if you need it.
local mouse = game.Players.LocalPlayer:GetMouse()
local remote = script.gunanimations
local fire = game.Players.LocalPlayer.Character:FindFirstChildOfClass("Humanoid"):FindFirstChildOfClass("Animator"):LoadAnimation(script.gunfire)
idle:Play()
local reloading = false
local torso:Part = game.Players.LocalPlayer.Character:FindFirstChild("viewmodel").Torso
local db = false
while task.wait() do
script.Parent.PistolGrip.important.bullethole.CFrame = torso.CFrame * CFrame.new(1.5, 1.04, -2.55) * CFrame.Angles(90, 0, 0) --debugging
end
mouse.Button1Down:Connect(function()
if reloading == false then
if db == false then
db = true
if script.Ammo.Value > 0 then
script.Parent.PistolGrip.important.bullethole.CFrame = torso.CFrame * CFrame.new(1.5, 1.04, -2.55) * CFrame.Angles(90, 0, 0)
remote:FireServer("fire", script.Parent.PistolGrip.important.bullethole.CFrame)
fire:Play()
else
remote:FireServer("fireblank")
end
wait(0.2)
db = false
end
end
end)