generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Attempt to index local "health"

Previous Thread :: Next Thread 
RobuxLife is not online. RobuxLife
Joined: 19 Sep 2012
Total Posts: 13336
13 Aug 2016 04:12 PM
local player = game.Players.LocalPlayer
local gui = game.ReplicatedStorage.GUI:Clone()
local text = gui:WaitForChild("TextLabel")
------------------------------------------------------------------------------------------------------------------------------

workspace:WaitForChild(player.Name)

gui.Parent = workspace:FindFirstChild(player.Name)
gui.Adornee = player.Character.Head
player.Character.Humanoid.NameDisplayDistance = 0
player.Character.Humanoid.HealthDisplayDistance = 0
player.Character.Humanoid.DisplayDistanceType = "None"
local hum = player.Character.Humanoid

local adminNames = {
RobuxLife = true,
Player1 = true,
}

function isPlayerAdmin(playerName)
return adminNames[playerName] or false
end

if isPlayerAdmin(player.Name) then
-- print(player.Name .. " is an admin")
text.Text = "Admin: "..player.Name.. " Health: "..hum.Health
text.TextColor3 = Color3.new(255,255,0)
hum.Health.Changed:connect(function()
text.Text = "Admin: "..player.Name " Health: "..hum.Health
end)
else
-- print(player.Name .. " is a player")
text.Text = "Player: "..player.Name.."Health: "..hum.Health
text.TextColor3 = Color3.new(255,255,255)
hum.Health.Changed:connect(function()
text.Text = "Player: "..player.Name " Health: "..hum.Health
end)
end

In the output, I get

17:11:23.207 - Players.RobuxLife.PlayerScripts.LocalScript:28: attempt to index field 'Health' (a number value)
17:11:23.207 - Stack Begin
17:11:23.208 - Script 'Players.RobuxLife.PlayerScripts.LocalScript', Line 28
17:11:23.208 - Stack End

so the health is changing


Report Abuse
RobuxLife is not online. RobuxLife
Joined: 19 Sep 2012
Total Posts: 13336
13 Aug 2016 04:14 PM
Sorry, *so the health ISN'T changing


Report Abuse
GamesDoneEasy is not online. GamesDoneEasy
Joined: 10 Jan 2016
Total Posts: 37
13 Aug 2016 04:16 PM
Make player and hum not local
Report Abuse
RobuxLife is not online. RobuxLife
Joined: 19 Sep 2012
Total Posts: 13336
13 Aug 2016 04:18 PM
@games

not working..


Report Abuse
RobuxLife is not online. RobuxLife
Joined: 19 Sep 2012
Total Posts: 13336
13 Aug 2016 04:22 PM
17:18:07.099 - Players.RobuxLife.PlayerScripts.LocalScript:28: attempt to index field 'Health' (a number value)
17:18:07.099 - Stack Begin
17:18:07.100 - Script 'Players.RobuxLife.PlayerScripts.LocalScript', Line 28
17:18:07.100 - Stack End

is EXACTLY what the output says.


Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image