Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why isnt this script working?

Asked by 10 years ago

This script is suppost to be a part of a screen gui that makes a text label read how many player points it has, but I wanted to add if it got below a certain ammont, the text will change to a warning about how the player points are low. Then when it gets above that certain ammount, the message goes back to normal.

points = Game:GetService("PointsService")
while true do
    wait(1)
    script.Parent.Text = "Available points: " ..Pointpoints:GetAwardables() .. ""
if Pointpoints:GetAwardables() = <500 then
script.Parent.Text = "Warning! Low on Points!  Available points: " ..Pointpoints:GetAwardables() .. ""
if Pointpoints:GetAwardables() = >501 then
script.Parent.Text = "Available points: " ..Pointpoints:GetAwardables() .. ""
if Pointpoints:GetAwardables() = 0 then
script.Parent.Text = "No points! Available points: " ..Pointpoints:GetAwardables() .. ""
end

2 answers

Log in to vote
0
Answered by 10 years ago

Please provide explanation with your answers. Simply posting code does not spread knowledge of integral scripting processes which helps people understand the logic and reasoning behind your answer.

first off, I would read this **wiki **page:

http://wiki.roblox.com/index.php?title=Player_Points

secondly, I would use the correct forms and variables for the loop.

Points = game:GetService("PointsService")
while wait(1) do
Awards = Points:GetAwardablePoints()
if Awards < 500 then
script.Parent.Text = "Warning, low points ["..Awards.."]!"
else
script.Parent.Text = "Awardable Points ["..Awards.."]"
end
end

ok, so what this does is set a variable "Points" to the PointsService on line 1. Then, it loops forever waiting every second on line 2. Then, it gets the available points to offer on line 3. If the points available is less than 500, (line 4), then change the text to a warning (line 5). Else, (if its not less than 500), then change it to a more suitable text (line 7)

Ad
Log in to vote
0
Answered by
BlueTaslem 18071 Moderation Voter Administrator Community Moderator Super Administrator
10 years ago

The operators are >= and <= for larger than or equal to and less than or equal. Equality is ==.

Note that you don't want to check both because at 500, both will occur.


You don't have ends or use elseifs on any of your conditions, so you don't have any properly defined blocks of code for any of the thens.


While not wrong, appending "" to the end of a string does nothing.

Answer this question