|
| 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
|
  |
| Joined: 23 Jan 2008 |
| Total Posts: 5350 |
|
|
| 03 Sep 2014 06:11 PM |
| what is the script parented in |
|
|
| Report Abuse |
|
|
|
| 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 |
|
|
|
| 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 |
|
|
| |
|
|
| 03 Sep 2014 06:38 PM |
Before
if hunger < 100 then
After
if hunger.Value.Value < 100 then
|
|
|
| Report Abuse |
|
|
|
| 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 |
|
|
|
| 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
|
  |
| 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 |
|
|
|
| 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 |
|
|