I have an automatic one too which works fine, they are using the same handler and connected the same
I have a gun, and an invisible part to create the bullets from. The part is falling and rising rapidly, making the bullets go farther down.
Yes it is welded, the part it is welded to is not moving either.
No errors.
The position rapidly goes up/down.
game.ReplicatedStorage.Events.Shoot.OnServerEvent:Connect(function(player, MuzzlePos, MousePos)
if player.Character then
local sound = player.Character.UpperTorso:FindFirstChild("FireSound")
if sound then
sound:Play()
end
local bullet = Instance.new("Part")
bullet.Shape = Enum.PartType.Cylinder
bullet.Name = "Bullet"
bullet.Parent = workspace
bullet.CanCollide = false
bullet.Anchored = false
bullet.Size = Vector3.new(.1, .1, 1)
bullet.CFrame = CFrame.new(MuzzlePos, MousePos)
bullet.Material = Enum.Material.Neon
bullet.BrickColor = BrickColor.new("Cool yellow")
game:GetService("Debris"):AddItem(bullet, 2)
bullet:SetNetworkOwner(player)
local bodyVelo = Instance.new("BodyVelocity")
bodyVelo.Parent = bullet
bodyVelo.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
bodyVelo.Velocity = (bullet.CFrame.LookVector * 200)
bullet.Touched:Connect(function(hit)
if hit.Parent ~= player.Character then
bullet:Destroy()
if hit then
if hit.Parent:FindFirstChild("Humanoid") then
hit.Parent:FindFirstChild("Humanoid"):TakeDamage(15)
end
end
end
end)
end
end)
Giving network ownership of the bullet to the player allows the player to use exploits to change the position of the bullet and damage players. Again, very easy to abuse.
The -Y speed is clearly from gravity. So what you’ve got is an unanchored part that is falling every frame and picking up speed over time. Something is moving it back up to where it should be each frame, but the velocity is not zero’d out, so it’s still falling.
If it really is welded, then there is some client-server desync in the physics, like the weld is only on the client, but the part is owned and falling on the server, or something along these lines. Otherwise, if it’s not a weld restoring its position every frame, there must be a script doing it. But probably it’s just a weld that doesn’t exist in both contexts.
Heres the old one (I don’t have an updated one):
game.ReplicatedStorage.Events.Shoot.OnServerEvent:Connect(function(player, MuzzlePos, MousePos)
if player.Character then
local sound = player.Character.UpperTorso:FindFirstChild("FireSound")
if sound then
sound:Play()
end
local bullet = Instance.new("Part")
bullet.Shape = Enum.PartType.Cylinder
bullet.Name = "Bullet"
bullet.Parent = workspace
bullet.CanCollide = false
bullet.Anchored = true
bullet.Size = Vector3.new(.1, .1, 1)
bullet.CFrame = CFrame.new(MuzzlePos, MousePos)
bullet.Material = Enum.Material.Neon
bullet.BrickColor = BrickColor.new("Cool yellow")
game:GetService("Debris"):AddItem(bullet, 2)
bullet:SetNetworkOwner(player)
bullet.Touched:Connect(function(hit)
if hit.Parent ~= player.Character then
bullet:Destroy()
if hit then
if hit.Parent:FindFirstChild("Humanoid") then
hit.Parent:FindFirstChild("Humanoid"):TakeDamage(15)
end
end
end
end)
end
end)
Sort of like detecting how fast a player is moving from the server, I will check the bullets position rapidly, it should not be changing the left and right axis too much. If its changing it by a wild amount I will kick the player and destroy the bullet.
It can easily happen if you make a weld instance from a client script, so that the weld only exists on the client and the part is just in freefall on the server.
Toggle between client and server view when you’re playing, and see what exists where, especially where the welds exist and that they are Active = true.
It could easily be that one gun is getting spawned on the server, but welded up by a client script, where as the other gun model might be in storage with weld instances already created inside it.
The viewmodel is duplicated from RS to the camera on the local script (so other people cant see your gun obviously). However the viewmodel in RS has the weld on it.