Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why does it Touch the baseplate in the air?

Asked by 4 years ago

This question has been solved by the original poster.

Here's how it goes: https://streamable.com/8xl8ty

local speed = script.Parent.Main.Speed.Value



function fire()
    local NewShell = Instance.new("Part", game.workspace)
    NewShell.Transparency = 0
    NewShell.Position = script.Parent.Barrel.Position
    NewShell.Velocity = script.Parent.Barrel.CFrame.RightVector * speed
    wait(0.1)
    NewShell.Touched:Connect(function(TouchedPart)
        print(TouchedPart.Name)
        NewShell.Anchored = true
    end)
    print("works")
end


script.Parent.Button.ClickDetector.MouseClick:Connect(fire)


0
there is no invisible part? gs_115 11 — 4y
0
No invisible part, if I move the cannon forwards past the baseplate - the part just drops okay and does not touch anything. Krolaer 6 — 4y

2 answers

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

I had similar problem in the past when anchoring a projectile, chances are the part does hit the baseplate on the server, but on the client visual it anchored before it hits the baseplate,

try changing the network ownership of the projectile with

NewShell:SetNetworkOwner(nil)

That will make the physic calculation purely on the server

Edit :

This bug is caused because the physic calculation is on the client side but the hit detection is on the server side, so when the part is hit on the server, it anchors the part too soon for the player.

0
Big thank you!!!!!!!!!!!!!!!!!! Krolaer 6 — 4y
Ad
Log in to vote
0
Answered by 4 years ago

It seems I had to wait around 15 seconds for the studio to load up after I press Play. Then it starts to work properly, without touching stuff while in the air.

Answer this question