Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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.

1 comment

0

You have to make a weld. You have to make an instance.new weld and then weld the parts u wana weld.

1 answer

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.

1 comment

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

This discussion is preserved as it was. New answers, comments, and votes are closed.