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

I don't know what I've done wrong with my Starterpack Script?

Asked by 9 years ago

I've used this starterpack script... I've placed the items I wanted for the teams into Lighting as stated. Put the names of the items into the script. Changed the team colours.

**It works, but instead of putting one of that item into the inventory it duplicates an infinite amount! I then tried to remove the ":clone()" which helped but it would only give one of that item, so if I respawned I would no longer receive it. **

Can someone help and tell me what I did wrong, and possibly help me edit it? NB I am not an advanced scripter or even a basic one.

Here is a copy of the script, changes have been set to fit my needs.

Thanks

script.Parent.Touched:connect(function(hit) 
if hit.Parent:findFirstChild("Humanoid") and game.Players[hit.Parent.Name].TeamColor == BrickColor.new("Pastel violet") then
c1 = game.Lighting.MasterKey:clone() 
c1.Parent = game.Players[hit.Parent.Name].Backpack 
c2 = game.Lighting.Tool:clone() 
c2.Parent = game.Players[hit.Parent.Name].Backpack 
c3 = game.Lighting.Tool:clone() 
c3.Parent = game.Players[hit.Parent.Name].Backpack 
c4 = game.Lighting.Tool:clone() 
c4.Parent = game.Players[hit.Parent.Name].Backpack 
end 
end)
0
Please put your script in a code block. yoshiegg6 176 — 9y
0
Sorry about that, done. BL4CKBlRD 5 — 9y

1 answer

Log in to vote
0
Answered by
SurVur 86
9 years ago

If you want them to respawn with it, just put one of each tool into the StarterGear folder of the player. Also, don't use the Touched event, use PlayerAdded and CharacterAdded.

game.Players.PlayerAdded:connect(function(plr) 
plr.TeamColor == BrickColor.new("Pastel violet") then
c1 = game.Lighting.MasterKey:clone() 
c1.Parent = plr.StarterGear 
c2 = game.Lighting.Tool:clone() 
c2.Parent = plr.StarterGear
c3 = game.Lighting.Tool:clone() 
c3.Parent = plr.StarterGear
c4 = game.Lighting.Tool:clone() 
c4.Parent =plr.StarterGear
end 
end)

This should fire only when a player joins the game. Also, don't use Lighting anymore, use ServerStorage or ReplicatedStorage.

0
I don't have a StarterGear folder :/ BL4CKBlRD 5 — 9y
Ad

Answer this question