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: What is wrong with this??

Previous Thread :: Next Thread 
adeep is not online. adeep
Joined: 06 Feb 2010
Total Posts: 274
04 Nov 2014 12:06 AM
No errors. It's supposed to wait until a value inside player is changed. When it's change run this code...

code-

local debounce = true
game.Players.LocalPlayer.Changed:connect(function()
local status = game.Players.LocalPlayer:FindFirstChild("Status1")
if status ~= nil and debounce == true then
debounce = false
while true do
if status.Value > 0 then
script.Parent.Ready.Value = false
script.Parent.Status.Visible = false
script.Parent.StatusFalse.Visible = true
while true do
wait(1)
status.Value = status.Value - 1
print(status.Value)
if status.Value <= 0 then
debounce = true
break
end
end
end
if status.Value <= 0 then
script.Parent.Ready.Value = true
script.Parent.StatusFalse.Visible = false
script.Parent.Status.Visible = true
debounce = true
end
break
end
debounce = true
end
end)

Report Abuse
128GB is not online. 128GB
Joined: 17 Apr 2014
Total Posts: 8056
04 Nov 2014 12:14 AM
Add some random prints and see what happens

is it a local script
Report Abuse
adeep is not online. adeep
Joined: 06 Feb 2010
Total Posts: 274
04 Nov 2014 12:21 AM
I did and yes it's a local script.
Report Abuse
128GB is not online. 128GB
Joined: 17 Apr 2014
Total Posts: 8056
04 Nov 2014 12:25 AM
So whats it doing and what should it be doing
Report Abuse
adeep is not online. adeep
Joined: 06 Feb 2010
Total Posts: 274
04 Nov 2014 12:31 AM
It does literally nothing. It's supposed to checked if an int value inside player is larger than 0 if it is then these gui labels become visible or non-visible.

But if you test in play solo and add prints in these locations --->

Code-

local debounce = true
game.Players.LocalPlayer.Changed:connect(function()
local status = game.Players.LocalPlayer:FindFirstChild("Status1")
if status ~= nil and debounce == true then
print(1) <-----------------HERE
debounce = false
while true do
if status.Value > 0 then
print(2) <-----------------HERE
script.Parent.Ready.Value = false
script.Parent.Status.Visible = false
script.Parent.StatusFalse.Visible = true
while true do
print(3) <-----------------HERE
wait(1)
status.Value = status.Value - 1
print(status.Value)
if status.Value <= 0 then
debounce = true
break
end
end
end
if status.Value <= 0 then
script.Parent.Ready.Value = true
script.Parent.StatusFalse.Visible = false
script.Parent.Status.Visible = true
debounce = true
end
break
end
debounce = true
end
end)

----------------------
In output nothing occurs... But when you press reset. the output changes. 1,2, and 3 apprear 1 each and in order in output... Only when I press reset tho?
Report Abuse
Ben1925 is not online. Ben1925
Joined: 07 Apr 2011
Total Posts: 741
04 Nov 2014 07:33 AM
Does it say where the stack ends? No output at all?
Report Abuse
128GB is not online. 128GB
Joined: 17 Apr 2014
Total Posts: 8056
04 Nov 2014 11:13 AM
Try changing
local status = game.Players.LocalPlayer:FindFirstChild("Status1")


to

local status = game.Players.LocalPlayer:waitForChild("Status1")
Report Abuse
adeep is not online. adeep
Joined: 06 Feb 2010
Total Posts: 274
04 Nov 2014 06:11 PM
No errors in output... It worked at once but it wasn't how I wanted... It's supposed to change a bool value to true/false then make a few gui's visible = true/false... If ready == false then it counts down from an intvalue put into player by other script. It's not changing gui's visibility and it's not counting down the timer...

New Code-

game.Players.LocalPlayer.Changed:connect(function()
local status = game.Players.LocalPlayer:WaitForChild("Status1")
local debounce = true
if status ~= nil and debounce == true then
debounce = false
if status.Value > 0 then
script.Parent.Ready.Value = false
script.Parent.Status.Visible = false
script.Parent.StatusFalse.Visible = true
while true do
wait(1)
status.Value = status.Value - 1
print(status.Value)
if status.Value <= 0 then
break
end
end
end
if status.Value <= 0 then
script.Parent.Ready.Value = true
script.Parent.StatusFalse.Visible = false
script.Parent.Status.Visible = true
end
debounce = true
end
end)
Report Abuse
adeep is not online. adeep
Joined: 06 Feb 2010
Total Posts: 274
04 Nov 2014 07:26 PM
Bump
Report Abuse
multimollusk is not online. multimollusk
Joined: 16 Jan 2012
Total Posts: 12
04 Nov 2014 07:41 PM
Well... im not 100% sure about this but..
.Changed activates when an object is changed.
it does not detect if an object inside of it is changed.
so in other words, something inside of the player like a property has to be changed for this to activate...
i dont think this is what you want it to do...
i would use the same .Changed method on all of the children inside of the LocalPlayer instead of just using it on the localplayer.
Report Abuse
adeep is not online. adeep
Joined: 06 Feb 2010
Total Posts: 274
05 Nov 2014 08:17 PM
Thank you so much!

I change change function line slightly and added this to beginning of code-

while true do
status = game.Players.LocalPlayer:FindFirstChild("Status1")
wait()
if status ~= nil then
break
end
end
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