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

How to make this part perfect in players hand?

Hey fellow ScriptingHelpers users, Im making a Piggy style game and Im 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!

3 comments

1

Please note that "Martelo" means Hammer and "Chave" is Key, forgot to translate it before posting as my game is on another language.

0

Hmmm....

0

idk try likemakin it longer or maybe have a part that you cant see so it pushes the key card

1 answer

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.

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