Pooglies
(Pooglies)
November 10, 2019, 2:41pm
#1
So I have this script that when activated, clones a mag and then throws the clone, but it does not work. Any help?
script.Parent.Fling.OnServerEvent:Connect(function()
local dog = script.Parent
script.Parent:FindFirstChild("Mag").Mag_Weld:Destroy()
print("destroyed weld")
local dog2 = script.Parent.Mag:Clone()
dog2.Velocity = dog2.CFrame.UpVector * 60
local weld = Instance.new("WeldConstraint")
weld.Parent = script.Parent.Mag
weld.Name = "Mag_Weld"
weld.Part0 = script.Parent.Mag
weld.Part1 = script.Parent.Handle
end)
How does it not work? Can you please elaborate?
1 Like
Pooglies
(Pooglies)
November 10, 2019, 2:43pm
#3
The “mag” just sits in my hand without being “thrown” and also it moves down a little each time (most likely from the welding process) I cannot think of an alternative or reason for this.
LowPolys
(LowPolys)
November 10, 2019, 3:04pm
#4
I’m not super familiar with velocity stuff, but you could try applying a BodyForce to the clone temporarily instead of changing the the velocity of the clone.
you need to parent the clone to the workspace or a descendant of the workspace for it to be viewed
--try this instead:
script.Parent.Fling.OnServerEvent:Connect(function()
local dog = script.Parent
script.Parent:FindFirstChild("Mag").Mag_Weld:Destroy()
print("destroyed weld")
local dog2 = script.Parent.Mag:Clone()
dog2.Parent = dog.Parent
dog2.Velocity = dog2.CFrame.UpVector * 60
local weld = Instance.new("WeldConstraint")
weld.Parent = script.Parent.Mag
weld.Name = "Mag_Weld"
weld.Part0 = script.Parent.Mag
weld.Part1 = script.Parent.Handle
end)