Hey fellow ScriptingHelpers users, Im making a Piggy style game and I
m making it to hold only one item per person and this is my keycard script (All others keys are perfect with same script but with different math) and no, ffs not making those parts tools as it would break the "concept" of the game.
local key = script.Parent script.Parent.ClickDetector.MouseClick:Connect(function(player) local char = player.Character if char:FindFirstChild("Chave") then local oldKey = char:FindFirstChild("Chave") oldKey.Parent = workspace oldKey.WeldConstraint:Destroy() oldKey.CFrame = key.CFrame * CFrame.Angles(0,math.rad(45),0) oldKey.CanCollide = true end if char:FindFirstChild("Martelo") then local oldKey = char:FindFirstChild("Martelo") oldKey.Parent = workspace oldKey.WeldConstraint:Destroy() oldKey.CFrame = key.CFrame * CFrame.Angles(0,math.rad(45),0) oldKey.CanCollide = true end key.Parent = char key.CFrame = char.RightHand.CFrame * CFrame.Angles(math.rad(180), math.rad(22.427), math.rad(-232.931)) --The math it uses local weld = Instance.new("WeldConstraint") weld.Parent = key weld.Part0 = key weld.Part1 = char.RightHand key.CanCollide = false end)
Screenshot: http://pays.host/uploads/b0425be8-fb89-4d7b-a116-2fc30390e660/mGivtSmT.png The problem is the commented line, I would be SO much appreaciated if someone helped me, thanks!
try pushing the keycard by putting a invisible part and the key card will be pushed i think i haven't tryed it cuz idk how lol.