So, i have a tool that i try to give myself with a script, the tool is located in replicated. But when i put it in my characters backpack and then equip it,it seems as if the sword is anchored and then teleports me to where the swords position is in studio when not playing. I don't know what i am doing wrong.
This is in a inventory gui btw
local disabled = false
script.Parent.MouseButton1Click:Connect(function()
local wep = script.Parent.Parent.Parent.Parent.Selected.Value
for i,v in pairs(script.Parent.Parent.Parent.Parent.Holder:GetChildren()) do
if v:IsA("ImageButton") then
if v.ID.Value == wep then
local togive = game.ReplicatedStorage[v.Name]:Clone()
local ID = Instance.new("NumberValue",togive)
ID.Value = v.ID.Value
ID.Name = "ID"
togive.Name = v.Name
for i,v in pairs(game.Players.LocalPlayer.Backpack:GetChildren()) do
if v:FindFirstChild("ID") then
if v.ID.Value == wep then
disabled = true
end
end
end
if disabled == false then
togive.Parent = game.Players.LocalPlayer.Backpack
end
end
end
end
disabled = false
end)
this is the script, i know it's sloppy. And if it is something obvious then please tell me, because i am really missing something here.

1 comment
Why?