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

The mesh part ignores the body velocity and behaves like it is anchored. How do fix this?

Asked by 5 years ago

This attack is supposed to be a sword the goes where the player's mouse is. For some reason, the body velocity doesn't work with the dagger and it behaves like its anchored even though it's not. If I move it in studio then the body velocity acts how its supposed to, but other than that it doesn't.

local rep = game:GetService("ReplicatedStorage")

local assets = rep:FindFirstChild("Assets")
local events = rep:FindFirstChild("RemoteEvents")
local lightEvent = events.Light

local v3 = Vector3

local dmg = 20

lightEvent.OnServerEvent:Connect(function(player, test)
    if test[1] == "Dagger" then
        local mousehit = test[2]

        local char = player.Character
        local rootPart = char:FindFirstChild("HumanoidRootPart")

        for i = 1,2 do
            local x = assets:FindFirstChild("Light_Dagger"):Clone()
            x.Parent = workspace
            x.CFrame = rootPart.CFrame * CFrame.new(math.random(-50,50),i*4,math.random(1,20))

            --wait()
            x.Anchored = false
            local bv = Instance.new("BodyVelocity")
            bv.Parent = x
            bv.MaxForce = v3.new(1,1,1) * math.huge
            bv.Velocity =  (x.Position - mousehit.p).Unit * -120
            x.CFrame = CFrame.new(x.Position, mousehit.p) * CFrame.Angles(math.rad(90),0,0)
        end

    end
end)

1 answer

Log in to vote
1
Answered by
Meqolo 78
5 years ago

Is it welded?

0
no iGlaciem 72 — 5y
0
I posted all of the code I used iGlaciem 72 — 5y
0
Yeah turns out there was a terrain weld iGlaciem 72 — 5y
Ad

Answer this question