local debris = game:GetService("Debris") --This is the Server Script local function shootbullet(origin,direction,ting) local part = Instance.new("Part") part.Parent = game.Workspace.Laseronias part.Material = Enum.Material.Plastic part.BrickColor = BrickColor.new("Gold") part.Size = Vector3.new(0.1,0.1,0.1) part.Anchored = true part.CanCollide = false part.Position = origin.Position for i = 0,1,0.1 do wait() part.Position:Lerp(ting,i) print("moved") print(ting) end end game.ReplicatedStorage.RemoteEvent.OnServerEvent:Connect(function(player,jP,oP) local DEST = (jP-oP.Position).Unit * 999 local tikn = (jP-oP.Position) local Res = workspace:Raycast(oP.Position,DEST) local resPart = Res.Instance if Res then print(Res.Instance.Name) if resPart.Parent:FindFirstChild("Humanoid") and resPart.Parent:FindFirstChild("Humanoid") ~= player.Character:FindFirstChild("Humanoid") then resPart.Parent:FindFirstChild("Humanoid"):TakeDamage(100) end end shootbullet(oP,DEST,tikn) end)
--This is the Localscript local Jerry = game.Players.LocalPlayer:GetMouse() local tool = script.Parent local origin = script.Parent.meGun.Origins local debounce = false local cooldown = 0.2 Jerry.TargetFilter = game.Workspace.Laseronias Jerry.TargetFilter = origin script.Parent.Activated:Connect(function() if debounce then return end debounce = true local jerryPos = Jerry.hit.p local oPos = origin game.ReplicatedStorage.RemoteEvent:FireServer(jerryPos,oPos) wait(cooldown) debounce = false end)
So it prints my correct position of the mouse and "moved" but it just doesnt move and stays at the origin position how i fix it ? !
Hello, ym5a!
You forgot to actually set the bullet position to the lerped position:
I also had to make some changes to make so the bullet will move at the same velocity every time
(SERVER SCRIPT)
local debris = game:GetService("Debris") --This is the Server Script local function shootbullet(origin,direction,ting) local part = Instance.new("Part") part.Parent = game.Workspace.Laseronias part.Material = Enum.Material.Plastic part.BrickColor = BrickColor.new("Gold") part.Size = Vector3.new(0.1,0.1,0.1) part.Anchored = true part.CanCollide = false part.Position = origin.Position local startPos = part.Position for i = 0,1,0.1 do wait() part.Position = startPos:Lerp(ting,i) print("moved") print(ting) end end game.ReplicatedStorage.RemoteEvent.OnServerEvent:Connect(function(player,jP,oP) local DEST = (jP-oP.Position).Unit * 999 local tikn = (jP-oP.Position) local Res = workspace:Raycast(oP.Position,DEST) local resPart = Res.Instance if Res then print(Res.Instance.Name) if resPart.Parent:FindFirstChild("Humanoid") and resPart.Parent:FindFirstChild("Humanoid") ~= player.Character:FindFirstChild("Humanoid") then resPart.Parent:FindFirstChild("Humanoid"):TakeDamage(100) end end shootbullet(oP,DEST,tikn) end)
If this answers your question, please don't forget to mark this as the Accepted Answer, it helps a lot