I keep getting the error 'Attempt to index nil with 'Character'. Here's the code:
local CMouse = require(script.CMouse) while CMouse:GetPlayer() == nil do game:GetService("RunService").Stepped:wait() end UserInputService = game:GetService("UserInputService") --For left mouse click and others local Player2 = game.Players.LocalPlayer local mouse = CMouse local db = true local damaged = false local PunchAnim = Instance.new("Animation") PunchAnim.AnimationId = "" Players = game:GetService("Players") plr = CMouse:GetPlayer() --getting all of the body parts. (R6) char = plr.Character or plr.CharactedAdded:wait() hum = char:FindFirstChildOfClass'Humanoid' local cam = game.Workspace.CurrentCamera --Getting the camera Camera = cam cam.CameraType = "Custom" t = char.Torso h = char.Head ra = char["Right Arm"] la = char["Left Arm"] rl = char["Right Leg"] ll = char["Left Leg"] tors = char:WaitForChild("Torso") lleg = char["Left Leg"] root = char.HumanoidRootPart hed = char.Head rleg = char["Right Leg"] rarm = char["Right Arm"] larm = char["Left Arm"] print(Players, plr, char, hum, cam, Camera, t, h, ra, la, rl, ll, tors, lleg, root, hed, rleg, rarm, larm, mouse) --Prints all of the stuff game.Players.LocalPlayer.Character:FindFirstChild("Right Arm").Touched:Connect(function(hit) if hit.Parent:FindFirstChild("Humanoid") and not db and not damaged and hit.Parent.Humanoid ~= game.Players.LocalPlayer.Character.Humanoid then damaged = true script.Punch:FireServer(hit.Parent.Humanoid) end end) UserInputService.InputBegan:Connect(function(input, event) if input.KeyCode == Enum.UserInputType.MouseButton1 then print("punch") end end)
I am trying to make a punch action for my glitcher, it is FE and i cant solve this, can some people help me? Please and thank you!