Hey, so recently I’ve started working on a small project. The point is to make it so when you press E a big orb comes out in front of you and it damages any players in it’s path. The thing is that the orb always goes down for whatever reason, here’s an example of what I’m talking about:
https://gyazo.com/a5531b11fda550c460be4b78e8261181
I’ve tried using math.Angles() and changing the rotation of the new part after it was created but neither worked and instead they made the orb fire from the origin point, I’ve tried changing the velocity so it’s higher incase gravity is pulling it down but nothing changed and I’ve tried to use different orb models, all of which suffered from the same issue.
If anyone can help me, then here’s the code:
(Client):
local uis = game:GetService("UserInputService")
uis.InputBegan:Connect(function(input)
if input.KeyCode == Enum.KeyCode.E then
print(game.Players.LocalPlayer.Character.Head.CFrame.RightVector)
game.ReplicatedStorage.Gunshot:FireServer(game.Players.LocalPlayer.Character.Head.CFrame.RightVector)
end
end)
(Server):
game.ReplicatedStorage.Gunshot.OnServerEvent:Connect(function(player, lookVector)
print(lookVector)
local debounce = true
local newFire = game.ReplicatedStorage.Part:Clone()
newFire.Position = player.Character.Head.Position
newFire.Parent = workspace
local bodyVelocity = Instance.new("BodyVelocity",newFire)
bodyVelocity.P = Vector3.new(10000,10000,10000)
bodyVelocity.MaxForce = Vector3.new(10000,10000,10000)
bodyVelocity.Velocity = lookVector * 300
newFire.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
if hit.Parent.Name ~= player.Name then
if debounce then
debounce = false
for i = 1,5,1 do
wait(1)
hit.Parent:FindFirstChild("Humanoid").Health = hit.Parent:FindFirstChild("Humanoid").Health - 10
end
wait(3)
debounce = true
wait(1)
newFire:Destroy()
end
end
end
end)
end)