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

Velocity-based throwing system not working on ground?

Asked by 5 years ago

Hey! So I made a throwing system, the only thing that is happening is that it is not working on the ground. Here is what happens:

https://gyazo.com/fcbdca946df874d9c7739175d1783ae9

This is my script. There is way more, but this is the only relevant part.

local Character = script.Parent
local Player = game.Players.LocalPlayer
local HumanoidRootPart = Character:FindFirstChild("HumanoidRootPart")
local Mouse = Player:GetMouse()
local PartChosen = false
local Whitelist = "Object"

local Object = workspace:FindFirstChild("ObjectBeam").Attachment1.Parent
Object.CanCollide = true
workspace:FindFirstChild("ObjectBeam"):Destroy()
workspace:FindFirstChild("ObjectWeld"):Destroy()
Object.Velocity = HumanoidRootPart.CFrame.LookVector * 100
print("A")
PartChosen = false
print("B")

Any help is appreciated.

P.S.: I came to the conclusion that it only worked the first time because when I threw it twice even someplace high it still didn't work, but that was proved wrong since I couldn't even throw a brick once in the ground.

P.S. 2: After a few throws on the ground, it starts working. I don't know why this happens, or if it is time-based or throw-based, but I still want it to work from the first throw.

Answer this question