Hi, I tried making a script that changes a players color when they click F. But for some reason this error keeps on showing up:
18:53:10.311 - ContextActionService: Unexpected error while invoking callback: Players.turbomegapower12345.PlayerGui.ZeusPowers:42: attempt to index global 'RightArmColor' (a nil value)
Here is my script:
local player = game.Players.LocalPlayer
local character = player.CharacterAdded:Wait()
local head = character:WaitForChild("Head")
local Humanoid = character:WaitForChild("Humanoid")
local torso = character.UpperTorso
local mouse = player:GetMouse()
local bodycolors = character:WaitForChild("Body Colors")
local Workspace = game.Workspace
local target
local God = player.PlayerGui.ChooseCharacter.God
--BREAKLINE--
local function onKeyPress(actionName, userInputState, inputObject)
target = mouse.Target
if userInputState == Enum.UserInputState.Begin then
if inputObject.KeyCode.Name =="T" then
if God.Value =="Zeus" then
game:GetService("Chat"):Chat(player.Character.Head, "MASTERBOLT!","Blue")
local tool = game.Workspace.BetaBolt:Clone()
character.Humanoid:EquipTool(tool)
wait(5)
tool:Destroy()
end
end
if inputObject.KeyCode.Name =="F" then
if God.Value =="Zeus" then
game:GetService("Chat"):Chat(player.Character.Head, "FEEL THE POWER OF A TRUE GOD!","Blue")
Humanoid.HipHeight = 20
bodycolors.RightArmColor = ("Dark blue")
wait(6)
--end of power--
Humanoid.HipHeight = 1.35
end
end
if inputObject.KeyCode.Name =="Q" then
if God.Value == "Zeus" then
game:GetService("Chat"):Chat(player.Character.Head, "LIGHTNING DASH!","Blue")
head.CFrame = head.CFrame * CFrame.new(0,0,-50)
else
print("FAIL LIGHTNING DASH")
end
end
if inputObject.KeyCode.Name =="E" then
if God.Value == "Zeus" then
game:GetService("Chat"):Chat(player.Character.Head, "THUNDER!","Blue")
local damage = game.Workspace.Damage:Clone()
local Thunder = Instance.new("Part")
Thunder.Name = ("ThunderBolt")
local mesh = Instance.new("SpecialMesh",Thunder)
mesh.MeshId = "rbxassetid://978945957"
mesh.TextureId = "rbxassetid://978945981"
Thunder.Anchored = true
Thunder.Orientation = Vector3.new(0,0,0)
mesh.Scale = Vector3.new(5,20,15)
damage.Position = Vector3.new(mouse.hit.x,mouse.hit.y,mouse.hit.z)
damage.Parent = workspace
Thunder.Position = Vector3.new(mouse.hit.x,mouse.hit.y,mouse.hit.z)
Thunder.Parent = workspace
wait(1)
damage:Destroy()
Thunder:Destroy()
else
print("FAIL THUNDERBOLT")
end
end
end
end
game:GetService("ContextActionService"):BindAction(
"keyPress",
onKeyPress,
false,
Enum.KeyCode.Q,
Enum.KeyCode.E,
Enum.KeyCode.F,
Enum.KeyCode.T
)

1 comment
Does any1 know a solution?