i am making a horror game and i have made something like a transition GUI
in which when the player touches the bed a frame and textbox appear with the text sleeping.But for some reason that script is not working!
You need to use Remote Events, not force the GUI to fade using a server script. Whenever a player touches the bed, a remote event is being fired. The GUI will receive that event and fade properly.
Editing the game.StarterGui won’t change a thing. If you really want to edit the player’s GUI with a server script, you should be using the player.PlayerGui.Sleeping.Frame path.
The starter gui is just a service where you put the guis and the guis will get cloned to the player gui when the player joins. As @InfiniteBlackPIX mentioned, you should use the player.PlayerGui
Are you aware that you have to get the player from the touch event?
game.Workspace.DoubleBed.MeshPart.Touched:Connect(function(hit)
local player = game:GetService("Players"):GetPlayerFromCharacter(hit.Parent)
if player then
local Sign = player.PlayerGui.Sleeping.TextBox
local Background = player.PlayerGui.Sleeping.Frame
Background.Visible = true
Sign.Visible = true
wait(4)
Background.Visible = false
Sign.Visible = false
end
end)
Not sure if it will work but try player.PlayerGui:SetCoreGuiEnabled(Enum.CoreGuiType.All, false). This will disable all the CoreGui elements (chat + leaderboard).