Cannot fill in the values within the tool

Hello, recently I’ve tried to make a tool where it will receive the player’s data and will fill those into the tool. Inside the tool I got some values need to be fill in order for it to work with some of my script. But the problem here is that it isn’t going to fill the values in. I’ve tried to use a duplication from the player’s data to the tool but it will causes duplicate values. Any help is appreciated!
Local script:

local RS = game:GetService(“ReplicatedStorage”)
local event = RS:WaitForChild(“CreateFlag”)
local gui = script.Parent
local button = gui:WaitForChild(“Spawn”)
button.MouseButton1Click:Connect(function()
event:FireServer()
end)


Server script:

– Create data

function plrAdded(plr)

– Create data
local folder = SS:WaitForChild(“FlagData”)
local groupID = folder:WaitForChild(“GroupID”)
local regiment = folder:WaitForChild(“Regiment”)
local team = folder:WaitForChild(“Team”)

team.Value = plr.Team.Name
for i, regIDs in pairs(sysModule.REGIMENT_IDS) do
for j, regTitle in pairs(sysModule.REGIMENT_TITLES) do

  	if plr:IsInGroup(mainGroup) and not plr:IsInGroup(regIDs) then
  		groupID.Value = mainGroup; regiment.Value = sysModule.MainGroupTitle; break
  	elseif plr:IsInGroup(mainGroup) and plr:IsInGroup(regIDs) then
  		groupID.Value = regIDs; regiment.Value = regTitle; break
  	end
  end

end
folder:Clone().Parent = plr
end
PS.PlayerAdded:Connect(plrAdded)

– Fill the data

RS.CreateFlag.OnServerEvent:Connect(function(plr)
repeat wait() until plr.Character
local char = plr.Character

local flagTool = SS:FindFirstChild(“Flag”)
if flagTool then do
flagTool:Clone().Parent = char

  	-- Player data
  	local folder = plr:WaitForChild("FlagData")
  	local groupData = folder:WaitForChild("GroupID").Value
  	local teamData = folder:WaitForChild("Team").Value
  	local regimentData = folder:WaitForChild("Regiment").Value

  	-- Flag data
  	local dataFolder = flagTool:WaitForChild("FlagData")
  	local group = dataFolder:WaitForChild("GroupID").Value
  	local team = dataFolder:WaitForChild("Team").Value
  	local regiment = dataFolder:WaitForChild("Team").Value

  	-- Fill in
  	team = teamData
  	group = groupData
  	regiment = regimentData
  end

else warn(“Flag tool not found!”) end
end)


Flag picture:
image

1 Like

Hey there, does the script error?

1 Like

There’s no output mister, the only thing that not work is the values

Ok so the poblem is I’m using a duplicate version, and it’s filling the data from the base tool so I have to move the :Clone() down.