So I had fix my problem with the button not appearing, but now the command I want it to do will not work. I am not sure why. Can you help me?
My Code is here:
local screenGui = Instance.new("ScreenGui") screenGui.Parent = script.Parent local textButton = Instance.new("TextButton") textButton.Parent = screenGui textButton.Position = UDim2.new(0, 25, 0, 50) textButton.Size = UDim2.new(0, 150, 0, 50) textButton.BackgroundColor3 = BrickColor.White().Color textButton.Text = "Click Me To Reset!" textButton.MoustButton1Down:connect(function() Health.Player = 0 end) textButton.MouseButton1Down:connect(function() textButton.Text = "I've been clicked!" end) --Line 10 I think is the Problem
You are correct, line 10 is your problem. Health is located in the Humanoid, which is in its Character. Also, you have not defined Player yet.
Check this out:
local player = game.Players.LocalPlayer --Make sure this script is in a LocalScript. local screenGui = Instance.new("ScreenGui") screenGui.Parent = script.Parent local textButton = Instance.new("TextButton") textButton.Parent = screenGui textButton.Position = UDim2.new(0, 25, 0, 50) textButton.Size = UDim2.new(0, 150, 0, 50) textButton.BackgroundColor3 = BrickColor.White().Color textButton.Text = "Click Me To Reset!" textButton.MoustButton1Down:connect(function() --Made the 2 functions into 1 function to shorten the script. player.Character.Humanoid.Health = 0 textButton.Text = "I've been clicked!" end)