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

How can I fix this script?

Something is wrong with this script and the output wont show any errors

local Player = game.Players.LocalPlayer;
local Mouse = Player:GetMouse();
z = game.Lighting.Claw:Clone()
Weld = Instance.new("Weld",z)

Mouse.KeyDown:connect(function(key)
if (Key:lower() == "e") then
Weld.Part0 = game.Player.Character:WaitForChild("RightArm")
Weld.Part1 = z

end
end	

If you have a solution please tell me.

1 answer

✓ Accepted answer

On line 06 you use the variable "key" for the key that is returned but on line 07 you access it using "Key" which you have not defined.

So just simply replace:

Mouse.KeyDown:connect(function(key)
	if key:lower() == "e" then
		--code
	end
end)

It is also recommended that you use UserInput instead of KeyDown as it is deprecated.

http://wiki.roblox.com/?title=API:Class/UserInputService

Edit: You are also not parenting "z" to anywhere so it basically doesn't exist yet. I'm guessing you want it in workspace so you will have to do:

z.Parent = workspace

2 comments

0

;( y u ignore me

0

Took a nap xD. That was 1 fix I'll just figure out the welding. Thanks!

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