Hello everyone on Devforum, recently I have made a game and it has a working jail. Basically what I want to achieve is a working Jail timer, but I have ran into some multiple problems.
Basically what happens is the person is Teleported to jail and they are not given the jail timer.
Also I want it to only Clone the “argplayer”
Down below is the remote that fires when they are booked, everything works except
local gui = game.ServerStorage.Jail
gui:Clone().Parent = argPlayer:WaitForChild(“PlayerGui”)
Remotes.Arrest.OnServerEvent:Connect(function(plr,argPlayer,Crime,Desc,crimeData)
argPlayer.Team = game.Teams.Incarcerated
argPlayer.Character.Head:Destroy()
Remotes.Notification:FireClient(argPlayer,"You have been arrested! You will be released in 200 seconds. Leaving the game to avoid jail time will result in moderation action.", "Arrested!", "Red", true)
local InteractController = require(script.Parent.InteractController)
InteractController.Stop(argPlayer)
local gui = game.ServerStorage.Jail
gui:Clone().Parent = argPlayer:WaitForChild("PlayerGui")
end)```
I am getting more and more familiar with scripting but I really need help with this as it is kinda ruining my game.
cheers - UhYouFoundRBLX
You can instead of cloning the GUI, just put it in the StarterGui and set the enabled property to true from the script.
Would that mean everyone can see it?
If not, would you mind sending what the script should look like?
1 Like
If you by default set it’s enabled property to false, and then change it from the PlayerGui, to true, t
for the arrested player, the no, not everyone will see it.
I can send an example, I’ll edit it in this post:
game.ReplicatedStorage.RemoteEcent.OnServerEvent:Connect(function(player)
player.PlayerGui.ScreenGui.Enabled = true
end)
something like this, make it’s disabled in the StarterGui and enabled in the PlayerGui.
1 Like
I am going to try this out. Please stand by
1 Like
argPlayer.Team = game.Teams.Incarcerated
argPlayer.Character.Head:Destroy()
Remotes.Notification:FireClient(argPlayer,"You have been arrested! You will be released in 200 seconds. Leaving the game to avoid jail time will result in moderation action.", "Arrested!", "Red", true)
local InteractController = require(script.Parent.InteractController)
InteractController.Stop(argPlayer)
argPlayer.PlayerGui.Jail.Enabled = true```
Yes, is the GUI in the starterGui?
Correct, I placed it in starter gui. Its name is also Jail.
1 Like
I am going to give this a try.
1 Like
Does it work now? It should make it visible only for the arrested player.
Ok so it doesn’t work, The jail screenGU in starterGUI is NOT enabled, I load into the game, go to my playerGuis and it says enabled.
It says it’s enabled, but it’s not?
Screenshot by Lightshot This is what it looks like when not testing, but when I load in the game it is enabled.
It does that for every player?
Try to make the line of changing the enabled property commented, does it still happen when it’s commented?
It still happens when commented, and what do you mean “Try to make the line of changing the enabled property”
I accidentally did not write commented, and are you sure nothing else enables this GUI? Maybe other scripts?
1 Like