local options = game.StarterGui.ScreenGui.Options
local Chr = script.Parent.StarterCharacter
local Buttons = {
options.Kagune,
options.Magic,
}
script.Parent.MouseButton1Click:Connect(function(player)
Chr.Parent = game.StarterPlayer
local character = player.Character
options.BackgroundTransparency = 1
Buttons.BackgroundTransparency = 1
Buttons.TextTransparency = 1
character.Humanoid.Health = 0
print("done")
end)
COMMUNITY QUESTION
does anyone know how to fix this error? attempt to index nil with 'Character'?
1 answer
local options = game.StarterGui.ScreenGui.Options
local Chr = script.Parent.StarterCharacter
local Buttons = {
options.Kagune,
options.Magic,
}
script.Parent.MouseButton1Click:Connect(function(player)
Chr.Parent = game.StarterPlayer
local character = player.Character ~~ Here
options.BackgroundTransparency = 1
Buttons.BackgroundTransparency = 1
Buttons.TextTransparency = 1
character.Humanoid.Health = 0
print("done")
end)
You already got the character which is player, you can just remove Character there so its
local character = player
This discussion is preserved as it was. New answers, comments, and votes are closed.
