So I have been trying to make a class fighting game kinda like Critical Strike but I have run in to some issues with the gun
local bulletbrick = script.Parent.bullet
script.Parent.Activated:Connect(function()
print("Its workng")
local bullet = bulletbrick:Clone()
bullet.Parent = script.Parent
bullet.Anchored = true
bullet.Weld:Remove()
bullet.damage.Disabled = false
bullet.CFrame = bullet.CFrame + bullet.CFrame.lookVector * 1
for x = 1, 10 do
wait((.01))
bullet.CFrame = bullet.CFrame + bullet.CFrame.lookVector * 1
end
bullet:remove()
end)
--and here is the script that is inside of the bullet
script.Parent.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") and hit.parent.Name ~= script.Parent.Parent.Parent.Name then
hit.parent.Humanoid.Health = hit.parent.Humanoid.Health -5
script.Parent:remove()
elseif hit.parent.Name ~= script.Parent.Parent.Parent.Name then
script.Parent:remove()
end
end)
however its laggy and weird here is a video [https://streamable.com/3qu2h0] So does anyone know how to fix this?

5 comments
Could you friend me? I wanna see whats up with the games you are making. For the actual answer i say that you must make the bullet unAnchored and waay more faster than that. I would not recommend doing it like that.
I would reccomend making its velocity its lookvector * 300 times or so.
But you have to unanchor it then.
how would I "velocity its lookvector * 300 times or so" I'm new to Lua and only started a few months ago so sorry if the answer is super simple
I oh I am incredibly dumb, although this still is a bit broken. here is a video of what happens https://streamable.com/3fh14e