GUI Doesnt wanna Open at the Start of the Game (Loads Data)

Hey Guys !

So ive been working lately on my latest game and

for some Reason i found a bug that doesnt open a Gui at Start…
This is all the Information i can provide:

Developer Gui Errors: - https://gyazo.com/c3660b6286f5fab895fd75e7e629ef90 (After it Happend)
Developer Gui Errors: - https://gyazo.com/415b2c5731a429f7c1fc8968b0f4a46d (Before it Happend)

Combat Gui Localscript (Script):

local char = game.Players.LocalPlayer.Character or game.Players.LocalPlayer.CharacterAdded:Wait()
local val = char:WaitForChild(“Timer”)

while true do
wait()
if val.Value > 0 then
script.Parent.Enabled = true
else
script.Parent.Enabled = false
end
end

(GUI That is Supposed to Open) Scripts:

wait(1)

local player = game:GetService(“Players”).LocalPlayer

local data = player:WaitForChild(“Data”)

local TextService = game:GetService(“TextService”)

local name = data:WaitForChild(“FirstName”)

if player.Chakra.MaxValue == 10 then

script.Parent.Enabled = true

end

[After Pressed Button]

local button = script.Parent
local currentTween

button.MouseEnter:Connect(function()

if currentTween then
	
	currentTween:Pause()
	
end

currentTween = game:GetService("TweenService"):Create(
    button,
    TweenInfo.new(0.25, Enum.EasingStyle.Quad, Enum.EasingDirection.Out),
    {
        Rotation = -180,
        Size = UDim2.new(5.5,0,5.5,0),
    }
)
 
currentTween:Play()

end)

button.MouseLeave:Connect(function()

if currentTween then
	
	currentTween:Pause()
	
end

currentTween = game:GetService("TweenService"):Create(
    button,
    TweenInfo.new(0.25, Enum.EasingStyle.Quad, Enum.EasingDirection.Out),
    {
        Rotation = 0,
        Size = UDim2.new(3,0,3,0),
    }
)
 
currentTween:Play()

end)

script.Parent.MouseButton1Click:connect(function()

local screenGui = script.Parent.Parent.Parent

local player = game.Players.LocalPlayer

if player:FindFirstChild(“Chakra”) then

if player.Chakra.MaxValue == 10 or player.Character.Humanoid.MaxHealth == 100 then

game.ReplicatedStorage.Events.LoadChar:FireServer()

end
end
end)

I personally just dont know what it wants from me :confused: thanks for any help !

Does the code you provided are all in one local script?

Of course you can (30 Characters)

No, but it magically worked again after a few Hours. idk what exactly happend tho

1 Like