hello.
i was trying to clone and place a script into a tool in the players backpack.
when trying to insert, it keeps on getting exhausted… why???
code:
local ToolName = script.TOOL_MAME_CONNECTION.Value.Name
script.Text.Value.Text = "Equip "..script.Ability_Script.Value.Name.." - "..script.Kills_Required.Value.." Kills"
script.PROMPT.Value.ObjectText = script.Ability_Script.Value.Name
local db = true
function Change_Ability(plr)
if db then db = false
for a,b in ipairs(plr.Backpack:GetChildren()) do
if b.Name == script.TOOL_MAME_CONNECTION.Value.Name then
b:FindFirstChild("ABILITY"):ClearAllChildren()
warn("CLEARED")
task.wait()
local Ability_Script = script.Ability_Script.Value:Clone()
Ability_Script.Parent = plr.Backpack -- THIS IS THE POINT OF EXHAUST!
warn("PLACED")
end
end
end
task.wait()
db = true
end
script.PROMPT.Value.Triggered:Connect(Change_Ability)