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

How to spawn with weld already equipped to player?

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?

1 comment

0

You have to weld the objects to the Character rig after it spawns.

1 answer

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.

2 comments

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 ]

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.

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