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
 

Re: Ugh(4)

Previous Thread :: Next Thread 
18lpickett is not online. 18lpickett
Joined: 15 Jul 2012
Total Posts: 3121
03 Sep 2014 06:09 PM
So i have this script :

player = game:GetService("Players").LocalPlayer

function OnTouch()
local hunger = script.Parent.Value
if (player.TeamColor == BrickColor.new("Bright green")) then

for i = 1,(1) do
if hunger < 100 then
wait(1)
hunger = hunger + 1
else break
end
end



game.Workspace.poop1.Plant1:remove()
end
return end

game.Workspace.poop1.Plant1.Touched:connect(OnTouch)


The output says 18:07:36.523 - Players.Player1.PlayerGui.HungerBar.Frame.Script2:8: attempt to compare userdata with number
Any idea what this means and how i could fix it?
Report Abuse
Bobobob12 is not online. Bobobob12
Joined: 23 Jan 2008
Total Posts: 5350
03 Sep 2014 06:11 PM
what is the script parented in
Report Abuse
masterblokz is not online. masterblokz
Joined: 17 Nov 2010
Total Posts: 9517
03 Sep 2014 06:11 PM
values can't be set as variables

remove the .value and in line # 8 put it there
Report Abuse
18lpickett is not online. 18lpickett
Joined: 15 Jul 2012
Total Posts: 3121
03 Sep 2014 06:19 PM
New error

18:18:58.443 - Players.Player1.PlayerGui.HungerBar.Frame.Script2:10: attempt to perform arithmetic on local 'hunger' (a userdata value)


Parent's startegui

i edited to this

player = game:GetService("Players").LocalPlayer

function OnTouch()
local hunger = script.Parent
if (player.TeamColor == BrickColor.new("Bright green")) then

for i = 1,(1) do
if hunger.Value.Value < 100 then
wait(1)
hunger = hunger + 1
else break
end
end



game.Workspace.poop1.Plant1:remove()
end
return end

game.Workspace.poop1.Plant1.Touched:connect(OnTouch)
Report Abuse
masterblokz is not online. masterblokz
Joined: 17 Nov 2010
Total Posts: 9517
03 Sep 2014 06:27 PM
remember the .Value bruv
Report Abuse
18lpickett is not online. 18lpickett
Joined: 15 Jul 2012
Total Posts: 3121
03 Sep 2014 06:38 PM
Before

if hunger < 100 then

After

if hunger.Value.Value < 100 then


Report Abuse
masterblokz is not online. masterblokz
Joined: 17 Nov 2010
Total Posts: 9517
03 Sep 2014 06:44 PM
player = game:GetService("Players").LocalPlayer

function OnTouch()
local hunger = script.Parent
if (player.TeamColor == BrickColor.new("Bright green")) then

for i = 1,(1) do
if hunger.Value < 100 then
wait(1)
hunger.Value = hunger.Value + 1 -- i ment this part
else break
end
end



game.Workspace.poop1.Plant1:remove()
end
return end

game.Workspace.poop1.Plant1.Touched:connect(OnTouch
Report Abuse
18lpickett is not online. 18lpickett
Joined: 15 Jul 2012
Total Posts: 3121
03 Sep 2014 06:46 PM
same error when i sued @above

Error : 18:45:19.369 - Players.Player1.PlayerGui.HungerBar.Frame.Script2:8: attempt to compare userdata with number
Report Abuse
Bobobob12 is not online. Bobobob12
Joined: 23 Jan 2008
Total Posts: 5350
03 Sep 2014 06:49 PM
player = game:GetService("Players").LocalPlayer

function OnTouch()
local hunger = script.Parent.Value
if (player.TeamColor == BrickColor.new("Bright green")) then

for i = 1,(1) do
if hunger.Value < 100 then
wait(1)
hunger.Value = hunger.Value + 1
else break
end
end



game.Workspace.poop1.Plant1:remove()
end
return end

game.Workspace.poop1.Plant1.Touched:connect(OnTouch)

if you would've just answered the question it would've been easier
Report Abuse
18lpickett is not online. 18lpickett
Joined: 15 Jul 2012
Total Posts: 3121
03 Sep 2014 06:57 PM
@above thanks for sticking with me, it worked :)

sadly the overall purpose of this was to make it to where it cant go over 100. That sadly wasn't achieved..
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