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

How to avoid mass duplicate tools for this script and only give when required?

How do I make it so if it finds "TechModel" have the tool, then it won't execute the script again because I get duplicates sometimes when I reset? If I don't have the tool, then it passes through and gives me the tools.

I did try

if players[i] == plr.Name and plr.BackPack("tool") then return

but it doesn't sound right and doesn't make sense.

local players = {"TechModel"}
local tool = script["The Rocket"]
local car = script.LimboJimbo

game.Players.PlayerAdded:Connect(function(plr)
	plr.CharacterAdded:Connect(function(chr)
		for i = 1, #players do
			if players[i] == plr.Name then
				tool:Clone().Parent = plr:WaitForChild("Backpack")
				LimboJimbo:Clone().Parent = plr:WaitForChild("Backpack")
			end
		end
	end)
end)

1 answer

✓ Accepted answer

Are you giving these tools to every player? If so, why aren’t you choosing to put the tools in the Starterpack? Just trying to clarify the situation.

But you are right, the issue is occurring after line 08. You need to check that the tools exists by their name and if they do not and the value isn’t nil, then clone. I’m waiting on an answer to a similar question about accessing the properties of tools when in use by a player.

1 comment

0

This is just like for owner tool only given to me.

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