crome60
|
  |
| Joined: 22 Nov 2008 |
| Total Posts: 15266 |
|
|
| 22 Sep 2013 10:43 AM |
Tagged is my custom value that I made to be inside of a custom NPC. The entire script works in Solo but not in Online mode. I am really lost and a bit hopeless here, so please give it your best. The model is: http://web.roblox.com/Enemy-item?id=116126620 (just incase you want an indepth look at the script, the script is called Core located in the torso.)
local Target = game.Players.LocalPlayer -------------------------------------------- CombatActive = script.Parent.CombatActive.Value -------------------------------------------- if CombatActive == true then script.Parent.Parent.SwordCombatAnim.Disabled = false end -------------------------------------------- function Display(Player) local f = Instance.new("TextLabel") local e = Instance.new("TextLabel") local s = Instance.new("ScreenGui") s.Name = "EnemyHealth" f.Parent = s e.Parent = s s.Parent = Player.PlayerGui f.Position = UDim2.new(0.300000012, 0, 9.09999969e-008, 0) f.Size = UDim2.new(0.400000048, 0, 0.100000001, 0) e.Position = UDim2.new(0.435000012, 0, 9.09999969e-008, 0) e.Size = UDim2.new(0.130000048, 0, 0.020000001, 0) f.BackgroundColor3 = BrickColor.new('Bright red').Color e.BackgroundColor3 = BrickColor.new('Sand red').Color script.Parent.ClickDetector:Remove() if Target then script.Parent.Parent.Tagged.Value = Target.Name end while true do f.Text = script.Parent.Parent.Humanoid.Health e.Text = script.Parent.Parent.Name wait() if script.Parent.Parent.Humanoid.Health == 0 then wait(3) script.Parent.Parent:Destroy() s:Destroy() end end end script.Parent.ClickDetector.MouseClick:connect(Display) -------------------------------------------- |
|
|
| Report Abuse |
|
|
crome60
|
  |
| Joined: 22 Nov 2008 |
| Total Posts: 15266 |
|
| |
|
|
| 22 Sep 2013 11:01 AM |
| There is no such color called Sand red |
|
|
| Report Abuse |
|
|
|
| 22 Sep 2013 11:02 AM |
Also it would be
= Color3.new() |
|
|
| Report Abuse |
|
|
|
| 22 Sep 2013 11:03 AM |
local Target = game.Players.LocalPlayer
You said custom 'npc' so I'm assuming this is in a regular script. LocalPlayer cannot be accessed in regular scripts. |
|
|
| Report Abuse |
|
|
|
| 22 Sep 2013 11:04 AM |
| @yoshi The way he did it is fine. Sand red is actually a valid color too. |
|
|
| Report Abuse |
|
|
Alex645ca
|
  |
| Joined: 02 Feb 2009 |
| Total Posts: 2531 |
|
|
| 22 Sep 2013 11:04 AM |
You used a localscript-only function in one of the first lines, localplayer.
So unless the NPC is parented to a player's character (as a pet or something), that's why it doesn't work. |
|
|
| Report Abuse |
|
|
crome60
|
  |
| Joined: 22 Nov 2008 |
| Total Posts: 15266 |
|
|
| 22 Sep 2013 11:05 AM |
| Alright, so what would I change the "local Target = game.Players.LocalPlayer" to? |
|
|
| Report Abuse |
|
|
|
| 22 Sep 2013 11:07 AM |
You don't.
-------------------------------------------- CombatActive = script.Parent.CombatActive.Value -------------------------------------------- if CombatActive == true then script.Parent.Parent.SwordCombatAnim.Disabled = false end -------------------------------------------- function Display(Player) local f = Instance.new("TextLabel") local e = Instance.new("TextLabel") local s = Instance.new("ScreenGui") s.Name = "EnemyHealth" f.Parent = s e.Parent = s s.Parent = Player.PlayerGui f.Position = UDim2.new(0.300000012, 0, 9.09999969e-008, 0) f.Size = UDim2.new(0.400000048, 0, 0.100000001, 0) e.Position = UDim2.new(0.435000012, 0, 9.09999969e-008, 0) e.Size = UDim2.new(0.130000048, 0, 0.020000001, 0) f.BackgroundColor3 = BrickColor.new('Bright red').Color e.BackgroundColor3 = BrickColor.new('Sand red').Color script.Parent.ClickDetector:Remove() if Player then script.Parent.Parent.Tagged.Value = Player.Name end while true do f.Text = script.Parent.Parent.Humanoid.Health e.Text = script.Parent.Parent.Name wait() if script.Parent.Parent.Humanoid.Health == 0 then wait(3) script.Parent.Parent:Destroy() s:Destroy() end end end script.Parent.ClickDetector.MouseClick:connect(Display) |
|
|
| Report Abuse |
|
|