LocalScript Gui Script Not Working?

I was working on a cutscene type thing and the script is a little messy but it works, my issue is there is one line of script that wont work.

The bolded line is the part that doesnt work.

–Here’s the script

game.Players.LocalPlayer.PlayerGui.ScreenGui.BlackScreen.Visible=true
game.Players.LocalPlayer.PlayerGui.ScreenGui.Frame.Visible=true
game.Players.LocalPlayer.PlayerGui.ScreenGui.Frame2.Visible=true
task.wait(4)
game.Players.LocalPlayer.PlayerGui.ScreenGui.BlackScreen.Visible=false
print(“check”)
task.wait(4.25)
game.Players.LocalPlayer.PlayerGui.ScreenGui.BlackScreen.Visible=true
game.Players.LocalPlayer.PlayerGui.ScreenGui.BlackScreen.BackgroundColor3 = Color3.fromRGB(255, 52, 52)
game.Players.LocalPlayer.PlayerGui.ScreenGui.Frame.Visible = false
game.Players.LocalPlayer.PlayerGui.ScreenGui.Frame2.Visible=false
game.Players.LocalPlayer.PlayerGui.ScreenGui.BlackScreen.Transparency=0
task.wait(0.5)
game.Players.LocalPlayer:Kick(“Why Did You Press The Button?”)

–idk if theres a bug but it just wont work, ive tried everything.

1 Like

Try:
game:GetService("Players").LocalPlayer.PlayerGui.ScreenGui:WaitForChild("BlackScreen").Visible = false

It’s kind of hard to guess what else might be wrong and what to focus on if you don’t tell us if there’s an error (what it is if there is one)

um couple of things

  1. Please show us the explorer where this script is located
  2. pretty sure :Kick() doesn’t work in local scripts
  3. you really should make ScreenGui variable
local Players = game:GetService("Players")
local Player = Players.LocalPlayer
local PlayerGui = Player:WaitForChild("PlayerGui")
local ScreenGui = PlayerGui:WaitForChild("ScreenGui")

now instead of having to do game.Players.LocalPlayer.PlayerGui.ScreenGui you can just do ScreenGui

it doesnt show an error whenever i run it

The script is located in StarterGui and i tried to make it a variable but the line of code still wont run or show an error.

does “check” print (screenshot where the script is)

yes check does print
(heres the screenshot)
Screenshot 2024-02-20 191808bnbn

sorry about the wait but i think its a bug with .visible so i just used .transparency instead

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.