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

How can I keep the tool model after unequipping for welding?

Asked by 5 years ago
Edited 5 years ago

I need some help with Welding...

game.ReplicatedStorage.GunFE.WeldBack.OnServerEvent:connect(function(Player, RArm, Tool) RArm.Transparency = 1 RArm.CFrame = Player.Character["UpperTorso"].CFrame local Weld = Instance.new("ManualWeld", Player.Character["UpperTorso"]) Weld.Part0 = RArm Weld.Part1 = Player.Character["UpperTorso"] Weld.C0 = RArm.CFrame Weld.C1 = Player.Character["UpperTorso"].CFrame Tool.Equipped:connect(function() Weld:Remove() end) end)

So basically, its supposed to show the gun on a player's back when its unequipped, but I dont know, how exactly to do that. (Im aware it wouldnt rotate properly, im getting to it) The issue is when I unequip the tool, it doesnt show up. Because it was unequipped. Is there a way to fix that? As seen I already got most of it figured out, but I cant quite figure out how to keep the tool model around after its unequipped.

0
i think the issue is that ur not parenting RArm to workspace so u cant see it Gameplayer365247v2 1055 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago

There are multiple ways to approach this, I'm going to list two ways to do it.

Most Ideal

This route will reduce the amount of code needed for your weapon to work. It'll run smoother and look/feel better. Though it requires animating and a little modeling skills. You would also have to ditch :Equipped() and :Unequipped() events and create your own.

The gun will be transferred to compacted meshes * This reduces the amount of moving parts thus removing unnecessary lag. * Removes weld problems * AnimationController to animate the gun itself

The gun will be animated with the player * Smoother transitions between equipping and un-equipping * No need to replicate it to the server * Cloning is not needed as it's already attached to the character

Optimal

This route is what I would go for from the looks what you are trying to achieve.

The gun will be pre-welded and have a clone * The clone will be attached to the player's back once his or her weapon is unequipped * The clone will disappear when the player equips a weapon

The gun will need to be replicated to the clients * The server can do clone it to the players back and adjust when equipping/un-equipping * The client can clone it for each player in the game and adjust when equipping/un-equipping

Hope this helps!

Ad

Answer this question