#Issues with thrown shuriken sticking in object (weld)

21 messages · Page 1 of 1 (latest)

velvet sage
#

Making a shuriken throwing tool, when the shuriken is thrown it is supposed to stop its velocity on hit and weld to the object it hit in the spot it hit it. Currently the first one binds to my own character and the rest go out and freeze mid air about half a second later.
code:

shuriken.Touched:Connect(function(Hit)
        if Hit.Name ~= Char.Name then
            VeloCity:Destroy()
            local weldcons = Instance.new("WeldConstraint")
            weldcons.Parent = shuriken
            weldcons.Part1 = shuriken
            weldcons.Part0 = Hit
            if Hit:IsA("BasePart") then
                local Humanoid = Hit.Parent:FindFirstChild("Humanoid")
                if not Hit:IsDescendantOf(Char) then
                    if Humanoid then
                        if Humanoid.Health > 0 then
                        Humanoid:TakeDamage(3)
                        
                            local hitanim = Instance.new("Animation")
                            hitanim.AnimationId = "rbxassetid://7826739990"
                            local animplayer = Humanoid:LoadAnimation(hitanim)
                            animplayer:Play()
                            
                        end
                    end
                end        
            end
        end
    end)

Video of whats happening ingame:
https://gyazo.com/c50bf959163a4ee97636f13ec2405f1a
ignore synthwave music in the background :)

silent berry
#

instead of destroying

#

the velocity

#

object on collison

#

u can set the velocity to zero using the "BodyVelocity" object

#

Replace the line "VeloCity:Destroy()" with:

#
local bodyVelocity = shuriken:FindFirstChildOfClass("BodyVelocity")
if bodyVelocity then
    bodyVelocity:Destroy()
end
#

thats option `

#

*1

#

option 2

#

is

#

to try n add a check

#

to make sure the shuriken isn't colliding with your character before welding it to any other objects

#
if Hit.Name ~= Char.Name and not Hit:IsDescendantOf(Char) then
#

one of the options should try to fix it from welding from ur character

velvet sage
#

alr ill try

#

Neither worked

#

Same exact otcome

#

outcome*

velvet sage
#

@silent berry What do you think the problem might be