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

Can I have help with my tool giving system?

Basically I have tools in ReplicatedStorage and a shelf with the models of the tools on it. When you click the tools' model you get the tool from ReplicatedStorage. My only problem is that whenever someone clicks it to get the tool it dosen't clone it, it takes it from someone else. If I have a tool, and someone clicks the tools' model on the shelf, I lose the tool and they get it even if I clone the tool in the script.

Here is my script (IT IS NOT A LOCALSCRIPT THOUGH):

local rep = game:GetService("ReplicatedStorage")
local baton1 = rep:WaitForChild("Police Baton v3")

script.Parent.ClickDetector.MouseClick:Connect(function(player)
  local baton2 = baton1:Clone()
  baton2.Parent = player.Backpack
end)

Yes, the clickdetector is also in the tool model.

1 comment

0

i.... have no idea :p

2 answers

Add this script script inside click detector.

local ReplicatedStorage = game.ReplicatedStorage
local Tool = ReplicatedStorage["Police Baton v3"]

script.Parent.MouseClick:Connect(function(click)
	local ClonedTool = Tool:Clone()
	ClonedTool.Parent = click.Backpack
end)

The script seems to be good. I'd recommend you using Remote Events for that action. I'd like you to tell me later if it worked/not for future questions. Thanks, XDvvvDX.

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