Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Sword seems anchored when i copy it to a players backpack?

Asked by
I_Nev 200 Moderation Voter
4 years ago

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.

2 answers

Log in to vote
1
Answered by 4 years ago

In your explorer, make sure every part in the tool isn’t anchored. If that doesn’t work, you could iterate through the descendants of the tool and set them to anchored false before parenting.

Ad
Log in to vote
-1
Answered by 4 years ago

There could be a weld in your Handle, delete it.

0
Why? RunKittenzRComin 170 — 4y

Answer this question