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

8 comments
KeyDown is deprecated, use UserInputService instead. Also since this would have to be a LocalScript, use "local player = game.Players.LocalPlayer" and "local character = player.Character or player.CharacterAdded:Wait()". Also use :Connect as :connect is deprecated.
What is "play'? Is it the player?
Your issue is that the character loads in after the script runs, so use the character variable I said.
Thanks!
Also... doing "script.Parent.Equip:FireServer()" does nothing as "Equipped" and "Unequipped" are events not properties. Use "script.Parent.Equipped:Connect(function()" instead and then fire the server.
Thanks, one of those fixes worked, I didn't realize i was using so many deprecated things.
No worries
No worries