-
What do you want to achieve? I want to turn visible on when function fires and ingame value is true
-
What is the issue? I have no idea the script is not turning them on as if like the lines do not exist, there are no errors and I have checked if it exist in PlayerGui it is there
-
What solutions have you tried so far? I have tried printing ImageButton name it printed it correctly so the imagbutton not nil but when I have done print(ImaggeButton.Parent) it did not print anything did not even give an error like the same issue Idk why
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoidrootpart = character:WaitForChild("HumanoidRootPart")
local currentCamera = workspace.CurrentCamera
local Camera1 = workspace:WaitForChild("Camera1")
local MainMenu = game.SoundService:WaitForChild("Main Menu")
local RunService = game:GetService("RunService")
local Surrender = player.PlayerGui:WaitForChild("SurrenderGui").TextButton
local TextBox = player.PlayerGui:WaitForChild("RP").TextBox
local ImageButton = player.PlayerGui:WaitForChild("RP").ImageButton
_G.FinishedUniform = false
_G.SelectingColor = false
local HeartBeatConnection
function PlayerInGame(Ingame)
if Ingame then
Surrender.Visible = true
TextBox.Visible = true
ImageButton.Visible = true
print(ImageButton.Parent)
print(ImageButton.Name)
print("All on")
currentCamera.CFrame = CFrame.new(humanoidrootpart.Position)
currentCamera.CameraType = Enum.CameraType.Custom
end
end
coroutine.resume(coroutine.create(function()
function HeartBeat()
if _G.SelectingColor ~= true and game.ReplicatedStorage.InGame.Value == false then
currentCamera.CFrame = currentCamera.CFrame * CFrame.Angles(0,0.001,0)
end
if _G.FinishedUniform and _G.ColorFinished then
game.Lighting.FogEnd = 5500000
repeat task.wait() until game.ReplicatedStorage.InGame.Value == true
PlayerInGame(game.ReplicatedStorage.InGame.Value)
print(HeartBeatConnection)
HeartBeatConnection:Disconnect()
end
end
end))
function PlayernotInGame()
Surrender.Visible = false
TextBox.Visible = false
ImageButton.Visible = false
HeartBeatConnection = RunService.Heartbeat:Connect(HeartBeat)
currentCamera.CFrame = CFrame.new(Camera1.Position)
currentCamera.CameraType = Enum.CameraType.Scriptable
end
game.ReplicatedStorage.InGame.Changed:Connect(function(InGame)
if not InGame then
MainMenu:Play()
PlayernotInGame()
end
end)
if game.ReplicatedStorage.InGame.Value == false then
print("testing")
MainMenu:Play()
PlayernotInGame()
end