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

How to make something stay on your body part and move with it?

Asked by 6 years ago

I am making a script which charges a red orb on the end of your outstretched arm, how would i make it stay with the arms movements?

game.ReplicatedStorage.Custom.OnServerEvent:Connect(function(plr,mousehit,key)
    if key == "Blast" then
        local char = game.Players[plr.Name].Character
        local hum = char.Humanoid
        local root = char.HumanoidRootPart
        local charging = Instance.new("Part",workspace)
        charging.Shape = Enum.PartType.Ball
        charging.Material = Enum.Material.Neon
        charging.Size = Vector3.new(0.1,0.1,0.1)
        charging.BrickColor = BrickColor.new("Really red")
        charging.CanCollide = false
        charging.Anchored = true
        charging.CFrame = char["Right Arm"].CFrame (--SymbolHere) ???????
    end
end)

Also, when the animation plays, it will go back to a regular position after a few seconds, which shouldn't happen.

0
You have to make a weld. You have to make an instance.new weld and then weld the parts u wana weld. Timbawolf1 6 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago
local weld = Instance.new(“Weld”, RightHandOrWhateverThePartIs)
weld.Part0 = RightHandOrWhateverThePartIs
weld.Part1 = OrbThatCharges
weld.C0 = RightHandOrWhateverThePartIs.CFrame:inverse()
weld.C1 = righthandorwhateverthepartis.CFrame * CFrame.new (0,0,0)—this will be how far the orb is from your right hand or whatever the part is 


when the animation is done delete the weld idk if this is 100% correct look up some tutorials i made this off the top of my noggin.

0
Your idea works for the most part, however now I cant move my body. And when i try to unanchor the orb, it disappears, that also happens when I anchor it after I make the weld DominousSyndicate 41 — 6y
Ad

Answer this question