Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 10 years ago

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

Log in to vote
0
Answered by
Discern 1007 Moderation Voter
10 years ago

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)
0
No offence, But you made my problem worse... iPrepared 30 — 10y
Ad

Answer this question