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

Cant re open Stat GUI Logo?

Asked by 4 years ago

Cant open stat Window again?

So I have a character stat window. To make it appear on the screen you need to click on the ImgButton. This ImgButton is located in the starterGUI. This button works fine.It has a notification script and a "AvailablePoints" text when you get points.

So the problem is i can open it and close it but i cant open it again. I get the error that takes me to the sample code

local Player = Game.Players.LocalPlayer

local GUI = Player.PlayerGui.HUD
GUI:WaitForChild("OpenStats")
GUI:WaitForChild("OpenArmor")

function OpenStats()
    if Player.PlayerGui:FindFirstChild("StatsGUI") == nil then
        Game.ReplicatedStorage.StatsGUI:Clone().Parent = Player.PlayerGui
    else print("GUI already open!")
    end
end

function OpenArmor()
    if Player.PlayerGui:FindFirstChild("ArmorGui") == nil then
        Game.ReplicatedStorage.ArmorGui:Clone().Parent = Player.PlayerGui
    else print("GUI already open!")
    end
end

GUI.OpenStats.MouseButton1Click:connect(OpenStats)
GUI.OpenArmor.MouseButton1Click:connect(OpenArmor)

exstra info

local script in the close txtButton

script.Parent.MouseButton1Click:Connect(function()
    script.Parent.Parent.Visible = false
end)

PointsNotification LocalScript

local Player = Game.Players.LocalPlayer

local Attributes = Player.attributes
local Leaderstat = Player.leaderstats
local Stats = Player.Stats

local Prop = Game.Workspace.GAME_PROPERTIES

local PGUI = Player.PlayerGui
PGUI:WaitForChild("HUD")
local GUI = PGUI.HUD
GUI:WaitForChild("OpenStats")
GUI.OpenStats:WaitForChild("AvailablePoints")

while true do
    if math.floor((Leaderstat.Lvl.Value / Prop.LevelsToGainPoints.Value) * Prop.PointGainIncrement.Value) + (Prop.StartingAttributes.Value * 4) + Prop.StartingAttributePoints.Value - (Attributes.Strength.Value + Attributes.Constitution.Value + Attributes.Intelligence.Value + Attributes.Dexterity.Value) > 0 then
        GUI.OpenStats.Style = "RobloxButtonDefault"
        GUI.OpenStats.AvailablePoints.Visible = true
    else GUI.OpenStats.Style = "RobloxButton"
        GUI.OpenStats.AvailablePoints.Visible = false
    end
    wait()
end

Answer this question