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 comment
its not a tool its a object