Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How can I fix this script?

Asked by 9 years ago

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

Log in to vote
0
Answered by
Ryzox 220 Moderation Voter
9 years ago

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

0
;( y u ignore me Ryzox 220 — 9y
0
Took a nap xD. That was 1 fix I'll just figure out the welding. Thanks! kingstephen23 35 — 9y
Ad

Answer this question