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?

01game.ReplicatedStorage.Custom.OnServerEvent:Connect(function(plr,mousehit,key)
02    if key == "Blast" then
03        local char = game.Players[plr.Name].Character
04        local hum = char.Humanoid
05        local root = char.HumanoidRootPart
06        local charging = Instance.new("Part",workspace)
07        charging.Shape = Enum.PartType.Ball
08        charging.Material = Enum.Material.Neon
09        charging.Size = Vector3.new(0.1,0.1,0.1)
10        charging.BrickColor = BrickColor.new("Really red")
11        charging.CanCollide = false
12        charging.Anchored = true
13        charging.CFrame = char["Right Arm"].CFrame (--SymbolHere) ???????
14    end
15end)

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
1local weld = Instance.new(“Weld”, RightHandOrWhateverThePartIs)
2weld.Part0 = RightHandOrWhateverThePartIs
3weld.Part1 = OrbThatCharges
4weld.C0 = RightHandOrWhateverThePartIs.CFrame:inverse()
5weld.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