Im intrested in making a game that contains shooting mechanics but Im not too familiar with roblox’s new physics… and BodyVelocity being deprecated.
If you can tell me whats wrong with it so it doesnt apply forces that would be splendid!
Issue: Projectile Spawns in Origin of world without any Velocity.
Expected Behavior: Projectile spawns at the “Barrel” attachment’s position and flys off with Speed Velocity, To a Point derived from Target.X and Target.Z because this game is a top down. and the Y should be the players HumanoidRootPart’s Y Value.
Hierachy / Explorer:
Server:
local Tool = script.Parent
local Event = Tool:WaitForChild("Shoot")
local Config = Tool:WaitForChild("Config")
Event.OnServerEvent:Connect(function(Player, Target)
local Character = Player.Character or Player.CharacterAdded:Wait()
local HumanoidRootPart = Character:WaitForChild("HumanoidRootPart")
local Projectile = Instance.new("Part", workspace.Projectiles)
Projectile.Shape = Enum.PartType.Ball
Projectile.BrickColor = BrickColor.new("White")
Projectile.Material = Enum.Material.Neon
Projectile.CanCollide = false
Projectile.Anchored = false
Projectile.Size = Vector3.new(.3,.3,.3)
Projectile.Position = Tool.Handle.Barrel.Position
local Velocity = Instance.new("BodyVelocity", Projectile)
Velocity.Velocity = Vector3.new(Target.X, HumanoidRootPart.Position.Y, Target.Z) * Config.Speed.Value
Velocity.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
game.Debris:AddItem(Projectile, 5)
end)
Client:
local Tool = script.Parent
local Event = Tool:WaitForChild("Shoot")
local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()
Tool.Activated:Connect(function()
Event:FireServer(Mouse.Hit)
end)
I have confirmed Speed is set to a Valid Number. The goal is to use Non Dated Roblox Physics!