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

How to spawn with weld already equipped to player?

Asked by 7 years ago

I'm trying to get 7 objects from my replicated storage to copy when the player spawns and weld themselves to the player. I have the welding part done but I can't get the player to spawn with these objects already welded to them. How would i do this?

0
You have to weld the objects to the Character rig after it spawns. Goulstem 8144 — 7y

1 answer

Log in to vote
0
Answered by 7 years ago

Upon the character spawning, you should clone the parts to weld into the player's character and then weld them from there. To detect a character spawning, use the CharacterAdded event of any player. You're going to want this to happen for each player that joins so use PlayerAdded for detecting that. When the character is spawned, you're going to face one problem, the parts aren't loaded in instantly; to avoid this being an error, simply :WaitForChild() on each of the parts you want to weld to.

game.Players.PlayerAdded:connect(function(plr) -- When a player joins
    plr.CharacterAdded:connect(function(char) -- When their character spawns in
        local torso = char:WaitForChild("Torso") -- Wait for the torso to exist
        --// Add your welding stuff here
    end)
end)

I hope this helps, if it doesn't, comment below with the problem you're faced with. If this works for you then accept it as the answer so people know this question has been answered.

If you're unable to add your welding script to this you could supply me with the code you have prepared for the welding and I could add it into the code supplied.

0
This is really helping me but I can't figure what to put when cloning the unions from my storage into my player. I tried this [ game.ReplicatedStorage["Muzzle 1"]:Clone() = game.Players ] TheTrueZecster 0 — 7y
0
Firstly you'd need to parent it to the player's character and secondly you'd need to actually script the weld. Ask this in a separate question after you've had a go and I or others would be happy to help. General_Scripter 425 — 7y
Ad

Answer this question