Trying to duplicate a part based on multiple int value inside of multiplier brick.
Not much to say so here is the script, error, and context
local Part = script.Parent
local textt = Part:WaitForChild("SurfaceGui").TextLabel
local multiplier = Part.Multiple.Value
local id = Part.ID
textt.Text = "x" .. multiplier
Part.Touched:Connect(function(hit)
if hit.Name == "Origin" or hit.Name == "Ball" then
print(hit:FindFirstChild("Touched").Value)
if hit:FindFirstChild("Touched").Value ~= id.Value then
print("val")
hit.Touched.Value = 1
for i = 1, multiplier do
local hc = hit:Clone()
hc.Touched.Value = id.Value
hc.Name = "Ball"
hc.Parent = game.Workspace
end
end
end
end)
(Ignore the prints in the script they were for debugging)