this is the error: Players.Jacobingg.Backpack.Stand.carrot2:9: attempt to index upvalue 'character' (a nil value)
It's suppose to send the unequip remote event when the player presses q (yes i accidentally swapped the two in my server script so im just doing that.), also this error started happening when i converted my tool script to just a script that activates when the player presses q.
I was also going to post the server script, but it's too long to post, so i'm not so sure what to do about that, i'm hoping the error just includes the local script.
--local Tool = script.Parent local play = script.Parent.Parent.Parent local character = play.Character local Mouse = play:GetMouse() Mouse.KeyDown:connect(function(key) if(key == "q")and not character:FindFirstChild("Stand") then script.Parent.unEquip:FireServer() elseif (key == "q")and character:FindFirstChild("Stand") then script.Parent.Equip:FireServer() end end) Mouse.Button1Down:connect(function() script.Parent.clicc:FireServer() end) local stand = character:WaitForChild('Stand') local StandHead = stand:findFirstChild("Head") local StandTorso = stand:findFirstChild("Torso") local StandHR = stand:findFirstChild("HumanoidRootPart") local StandRA = stand["Right Arm"] local StandLA = stand["Left Arm"] local StandRL = stand["Right Leg"] local StandLL = stand["Left Leg"] game:GetService("RunService").Stepped:connect(function() StandHead.CanCollide = false StandTorso.CanCollide = false end) local color = BrickColor.random() StandHead.BrickColor = color StandTorso.BrickColor = color StandLA.BrickColor = color StandLL.BrickColor = color StandRA.BrickColor = color StandRL.BrickColor = color
CharacterAdded
event. This will yield until the character has been added and return the character.--local Tool = script.Parent local play = game.Players.LocalPlayer local character = play.Character or play.CharacterAdded:Wait() -- wait for char local uis = game:GetService("UserInputService") -- KeyDown is deprecated uis.InputBegan:Connect(function(key, gpe) if gpe then return end--if they're chatting end the function if key.KeyCode == Enum.KeyCode.Q and not character:FindFirstChild("Stand") then script.Parent.unEquip:FireServer() elseif character:FindFirstChild("Stand") then script.Parent.Equip:FireServer() end end) uis.InputBegan:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseButton1 then -- if mouse button 1 pressed... script.Parent.clicc:FireServer() end end) local stand = character:WaitForChild('Stand') local StandHead = stand:FindFirstChild("Head")--findFirstChild deprecated local StandTorso = stand:FindFirstChild("Torso") local StandHR = stand:FindFirstChild("HumanoidRootPart") local StandRA = stand["Right Arm"] local StandLA = stand["Left Arm"] local StandRL = stand["Right Leg"] local StandLL = stand["Left Leg"] game:GetService("RunService").Stepped:Connect(function() StandHead.CanCollide = false StandTorso.CanCollide = false end) local color = BrickColor.Random()--random deprecated StandHead.BrickColor = color StandTorso.BrickColor = color StandLA.BrickColor = color StandLL.BrickColor = color StandRA.BrickColor = color StandRL.BrickColor = color