#Can anyone help me with a duplicate button script
30 messages · Page 1 of 1 (latest)
local button = script.Parent:WaitForChild("Button")
local detector = script.Parent:WaitForChild("Detector")
local target = script.Parent:WaitForChild("Target")
local SS = game:GetService("ServerStorage")
local cloneables = SS:WaitForChild("Cloneables")
local TC_Model = cloneables:WaitForChild("Spherek")
button.ClickDetector.MouseClick:Connect (function(plr)
local model = TC_Model:Clone("Spherek")
model.Parent = game.Workspace
model :SetPrimaryPartCFrame(target.CFrame)
local ReplicatedStorage = game:GetService("ReplicatedStorage")
end)
ill try to find the problem
Why is there something inside the Clone()
yeah
try removing it
also are there any errors?
Nice
just use a debounce
local button = script.Parent:WaitForChild("Button")
local detector = script.Parent:WaitForChild("Detector")
local target = script.Parent:WaitForChild("Target")
local SS = game:GetService("ServerStorage")
local cloneables = SS:WaitForChild("Cloneables")
local TC_Model = cloneables:WaitForChild("Spherek")
local cooldown = 1
local deb = true
button.ClickDetector.MouseClick:Connect (function(plr)
if not deb then return end -- if deb is false it cancels this function
deb = false
local model = TC_Model:Clone("Spherek")
model.Parent = game.Workspace
model :SetPrimaryPartCFrame(target.CFrame)
local ReplicatedStorage = game:GetService("ReplicatedStorage")
task.wait(cooldown) -- task.wait() is a better wait()
deb = true
end)
should have a 1 second cooldown
** You are now Level 1! **
u waited for the cooldown right?
try setting the cooldown variable to 0 and see if you can spam it
no errors as well?
can u upload ur model and send me the link? U can make it private after I fix it
the serverstorage and the model
So I could recreate it
and debug it faster
no worries
** You are now Level 2! **
ill start looking for the problem
u gotta make them downloadable
its private rn
Use clone statement for example workspace.part = clone().parent.part
Run the function with fire event and make that function clones the part.
You might check examples of it.
Maybe perhaps
If you use scripts without learning whatsoever and not knowing what you do then you should actually learn scripting