Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Why wont the part of my script make the player Reset?

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

1 answer

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)

1 comment

0

No offence, But you made my problem worse...

This discussion is preserved as it was. New answers, comments, and votes are closed.