Unable to cast coordinate frame?
Asked by
5 years ago Edited 5 years ago
while wait()do
local ammo = script.Ammo
local mousePosition = script.MousePosition
wait(.5)
if script.Ammo.Value > 0 then
local bullet = Instance.new("Part", workspace)
bullet.Size = Vector3.new(4, 0.05, 0.05)
bullet.Anchored = true
local plr = script.Parent.Parent.Parent.Name
bullet.Orientation = script.Parent.MainShootPart.Orientation
bullet.Position = script.Parent.MainShootPart.Position
local CFrame1 = bullet.CFrame
local CFrame2 = script.MousePosition
for i = 0,100,1 do
bullet.CFrame = CFrame1:lerp(CFrame2,i/200)
wait()
end
end
end