|
| 02 Mar 2014 10:56 AM |
| When player dies PlayerGui is reloading. I've got a script in Player which requires GUI to work. When player dies, script breaks and it doesnt work because of Gui reloading. Have you got any idea how to solve that problem? |
|
|
| Report Abuse |
|
|
| |
|
| |
|
| |
|
| |
|
|
| 03 Mar 2014 11:58 AM |
Ls = script.Parent.Parent.Values BestTime = Ls.BestTime LastTime = Ls.LastTime Running = Ls.Running TimesDid = Ls.TimeDid LocalTime = Ls.LocalTime CurrentFrame = script.Parent.Parent.PlayerGui.ScreenGui.CurrentFrame WinnerFrame = script.Parent.Parent.PlayerGui.ScreenGui.WinnerFrame
Running.Changed:connect(function(Val) if Running.Value then while Running.Value do -- I want to break that loop while Val == false wait(1) LocalTime.Value = LocalTime.Value+1 end
elseif Running.Value == false then CurrentFrame.Visible = false WinnerFrame.Visible = true LastTime.Value = (math.floor(LocalTime.Value)) TimesDid.Value = TimesDid.Value+1 WinnerFrame.LastTime.Text = (math.floor(LastTime.Value)) LocalTime.Value = -1 -- NewRecord = Instance.new("IntValue") NewRecord.Name = LastTime.Value.." - "..script.Parent.Parent.Name NewRecord.Parent = game.Lighting -- if BestTime.Value >= LastTime.Value then BestTime.Value = LastTime.Value end wait(7) CurrentFrame.Visible = true WinnerFrame.Visible = false end end)
while true do wait() CurrentFrame.CurrentTime.Text = (math.floor(LocalTime.Value%86400/3600))..":"..(math.floor(LocalTime.Value%3600/60))..":"..((LocalTime.Value%60)) CurrentFrame.BestTime.Text = (math.floor(BestTime.Value%86400/3600))..":"..(math.floor(BestTime.Value%3600/60))..":"..((BestTime.Value%60)) CurrentFrame.TimesDid.Text = TimesDid.Value.." try" CurrentFrame.LastTime.Text = (math.floor(LastTime.Value%86400/3600))..":"..(math.floor(LastTime.Value%3600/60))..":"..((LastTime.Value%60)) end
Everything works fine, but it doesnt work after dying because there is no GUI for some time. Re-copying script wont work because it requires script to be in the same place, all the time. Script is put into PlayerGui with ScreenGui. I tried to put it directly into Player but it really doesnt work. |
|
|
| Report Abuse |
|
|
EcIiptic
|
  |
| Joined: 12 Aug 2009 |
| Total Posts: 13737 |
|
|
| 03 Mar 2014 12:01 PM |
um
waitforchild("PlayerGui")
xd
#ScriptingHelper |
|
|
| Report Abuse |
|
|
|
| 03 Mar 2014 12:13 PM |
um
doesnt work
19:13:23.750 - CurrentTime is not a valid member of Frame 19:13:23.750 - Script 'Players.Player1.Backpack.MainScript', Line 42 19:13:23.765 - stack end
script.Parent.Parent.PlayerGui:WaitForChild("ScreenGui")
Ls = script.Parent.Parent.Values BestTime = Ls.BestTime LastTime = Ls.LastTime Running = Ls.Running TimesDid = Ls.TimeDid LocalTime = Ls.LocalTime CurrentFrame = script.Parent.Parent.PlayerGui.ScreenGui.CurrentFrame WinnerFrame = script.Parent.Parent.PlayerGui.ScreenGui.WinnerFrame
Running.Changed:connect(function(Val) if Running.Value then while Running.Value do -- I want to break that loop while Val == false wait(1) LocalTime.Value = LocalTime.Value+1 end
elseif Running.Value == false then CurrentFrame.Visible = false WinnerFrame.Visible = true LastTime.Value = (math.floor(LocalTime.Value)) TimesDid.Value = TimesDid.Value+1 WinnerFrame.LastTime.Text = (math.floor(LastTime.Value)) LocalTime.Value = -1 -- NewRecord = Instance.new("IntValue") NewRecord.Name = LastTime.Value.." - "..script.Parent.Parent.Name NewRecord.Parent = game.Lighting -- if BestTime.Value >= LastTime.Value then BestTime.Value = LastTime.Value end wait(7) CurrentFrame.Visible = true WinnerFrame.Visible = false end end)
while true do wait() CurrentFrame.CurrentTime.Text = (math.floor(LocalTime.Value%86400/3600))..":"..(math.floor(LocalTime.Value%3600/60))..":"..((LocalTime.Value%60)) CurrentFrame.BestTime.Text = (math.floor(BestTime.Value%86400/3600))..":"..(math.floor(BestTime.Value%3600/60))..":"..((BestTime.Value%60)) CurrentFrame.TimesDid.Text = TimesDid.Value.." try" CurrentFrame.LastTime.Text = (math.floor(LastTime.Value%86400/3600))..":"..(math.floor(LastTime.Value%3600/60))..":"..((LastTime.Value%60)) end |
|
|
| Report Abuse |
|
|
| |
|