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 » Scripting Helpers
Home Search
 

"Tagged" Value showing in Solo but not in Online

Previous Thread :: Next Thread 
crome60 is not online. 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 is not online. crome60
Joined: 22 Nov 2008
Total Posts: 15266
22 Sep 2013 11:00 AM
b1
Report Abuse
yoshimaster240102 is not online. yoshimaster240102
Joined: 14 Apr 2012
Total Posts: 470
22 Sep 2013 11:01 AM
There is no such color called Sand red
Report Abuse
yoshimaster240102 is not online. yoshimaster240102
Joined: 14 Apr 2012
Total Posts: 470
22 Sep 2013 11:02 AM
Also it would be


= Color3.new()
Report Abuse
ScrewDeath is not online. ScrewDeath
Joined: 03 Jun 2012
Total Posts: 2700
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
ScrewDeath is not online. ScrewDeath
Joined: 03 Jun 2012
Total Posts: 2700
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 is not online. 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 is not online. 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
ScrewDeath is not online. ScrewDeath
Joined: 03 Jun 2012
Total Posts: 2700
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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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