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

Item Equipped Upon Entrance?

I've been trying for the past few hours, and I cannot seem to come up with a script that allows me to add a model to my character upon entrance of the game, such as a cape or model backpack. I don't know if any of you remember the Roman Parthia, but upon entrance you'd be forced to wear a Tanned Tunic as a starter item and I'm looking to do this but only having the model equipped to you if you are in the specified group.

game.Players.PlayerAdded:connect(function(player)
    repeat wait()until player.Character
    local ModelId=144776710
    if player.Name=="Vhaeron"then
        ModelId=144776710
    end
    local ModelId = game:service("InsertService"):LoadAsset(ModelId):GetChildren()[1]
    ModelId.Parent=player.Character
end)

1 answer

Well, if you want models then you will need to call a weld script when

game.Workspace.ChildAdded:connect(function(AddedItem)
	if AddedItem:GetPlayerFromCharacter() then
	--Weld
	else
end

You can also modify that by doing

plr =  AddedItem:GetPlayerFromCharacter()
if plr and plr:IsInGroup(GroupId) then
	--Weld

As for tools, you could modify it by getting the humanoid and using :ForceEquip()

Hope this helps.

5 comments

0

I'm just peculiar as to how I somehow incorporate the cape into the script and weld it to the torso and such. Thank you though.

0

Hm...Welding is a tricky thing... If you want to try something fun you could take a weld script, place it in the model you want..Modify it so it welds to a character, and then make it a _G. function and call it on the player added script

0

I wish I had any experience with lua, but I can barely read the scripts I am looking at as of current, is there any site you'd suggest I start off with for the basics?

0

Try this tutorial series, it should help you get to understand some of the basics (gets harder as you progess in the pages): http://wiki.roblox.com/index.php?title=Intro_to_Scripting

0

Personally, I learned by trying to make things and failing...Literally.. I would just sit there and google what I needed to know to make what I wanted. There are a few good Lua tutorial games on ROBLOX that teach with GUis, as well as YouTube videos.

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