Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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

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

1 comment

0

its not a tool its a object

This discussion is preserved as it was. New answers, comments, and votes are closed.