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

[Inactive] Why does my keys not work when i try to "drop" the other one?

Asked by 4 years ago
Edited 3 years ago

i have 2 Keycard and they have this script:

local KeyName = script.KeyName
local KeyColor = script.KeyColor
KeyName.Value = script.Parent.Parent.Name
local colorBlock = script.Parent.Parent.Clr
colorBlock.BrickColor = KeyColor.value

script.Parent.MouseClick:Connect(function(plr)
    local chr = plr.Character
    local key = script.Parent.Parent


    if chr:FindFirstChild(KeyName) then
        local oldKey = chr:FindFirstChild(KeyName)
        oldKey.Parent = workspace
        oldKey.WeldConstraint:Destroy()
        oldKey.CFrame = key.CFrame * CFrame.Angles(0,0,math.rad(15))
    end

    key.Parent = chr
    key.CFrame = chr.RightHand.CFrame * CFrame.Angles(math.rad(90),0,math.rad(180))

    local weld = Instance.new("WeldConstraint")
    weld.Parent = key
    weld.Part0 = key
    weld.Part1 = chr.RightHand
end)

Workspace: https://imgur.com/a/fWASchb

When you pick one up it does that fine but when you click another one it should drop the one you just picked up and then pick up the other one. idk why it doesnt work but it just doesnt.

Edit: Ive done everything on GnomeCode's tutorial or whatever it is. https://www.youtube.com/watch?v=s-zXAgU_sKA&t

Everything else works fine except the keys

1 answer

Log in to vote
0
Answered by 4 years ago

Go to the keycard tool and look in properties if you setted CanBeDropped to true

0
its not a tool its a object EiOooAxea 70 — 4y
Ad

Answer this question