So far Ive made a script that shoots a ball when ever it detects a part or a human etc but I don't know how to make a CFrame of the bullet moving from the start position to the hit position.
local ray = Ray.new(script.Parent.Position,Vector3.new(0,0,-40)) local test = game.Workspace.test local Debris = game:GetService('Debris') while wait(1)do local hit,position = workspace:FindPartOnRayWithIgnoreList(ray,{script.Parent}) if hit then print(hit.Name) local o = Instance.new("Part",game.workspace) o.Anchored = false o.CFrame = CFrame.new(position) o.Size = Vector3.new(1,1,1) o.Shape = "Ball" o.BrickColor = BrickColor.new("Bright green") o.Material = "Neon" o.Parent = test Debris:AddItem(o,2)-- It will delete the projectile after 2 seconds end end
Im quite new to coding and i'm Interested to learn more.