SurfaceGui still does not work after reset

I’m experiencing a problem where my SurfaceGuis break when I reset. I cannot click on the buttons or anything. This only happens when they’re set from the StarterGui.

I found something relating to the issue here:

However, this issue looks like it was marked as resolved a while back and I’m confused why I’m still experiencing it. I have also tried altering the ResetOnSpawn property on the SurfaceGuis, but nothing has changed (I only tested this part in studio, didn’t think it’d have much difference in game, but I could be wrong)

Any ideas on how to fix this?

Where is the local script that you are using to detect surface gui clicking? And can we see this script?

2 Likes

I’ve probably messed up somewhere, but here it is. (i know the conditional statement is very long)

if Player:GetRankInGroup(groupId) < 6 or su1.Value ~= "" or su2.Value == Player.Name or su3.Value == Player.Name or su4.Value == Player.Name or su5.Value == Player.Name or su6.Value == Player.Name or su7.Value == Player.Name or su8.Value == Player.Name or su9.Value == Player.Name then
	print("Rank too low")
else
	su1.Value = Player.Name
	usernameset.Text = Player.Name .. " IS CURRENTLY WORKING"
	uservalue.Value = usernameset.Text
	screen1.Visible = false
	screen2.Visible = true
	RE:FireServer()
    end
end)

RE.OnClientEvent:Connect(function(taker)
    usernameset.Text = taker.Name .. " IS CURRENTLY WORKING"
	uservalue.Value = usernameset.Text
	screen1.Visible = false
	screen2.Visible = true
end)
--// Server Script
local RE = game.ReplicatedStorage.Events.ClientShow

RE.OnServerEvent:Connect(function(player)
    RE:FireAllClients(player)
end)

I’ve seen a lot of people have this problem (including myself). If you don’t want the UI object to be recreated when you reset (which destroys all event listeners on every object in the UI), disable the ResetOnSpawn property in the SurfaceGui object.

I’m honestly not sure why this property exists at all. It seems to be more headache inducing than helpful. If this solved your problem, make sure to mark this post as the solution! :slight_smile:

3 Likes

This is the solution that I’ve seen on the previous topic & on the Wiki, however it still occurs. I disabled the ResetOnSpawn property and it still happens when I reset. This time, I checked in game and in studio and results are the same.

1 Like

I believe this is a Roblox bug then.

1 Like

It does appear to be, but I’m surprised no one has brought it up recently if the bug is back since the last time they fixed it (unless I’ve just missed it). Any temporary solutions or should I wait for a solution/bug fix?

Could you provide a re-pro file so I can mess around a lil bit and check?

Where is the connection for the clicking made inside the script, where is the script located? Can we see the whole script? There could be a lot of things like wrong references and such causing this behavior

repro.rbxl (18.7 KB)
This is a shortened version of the script that I compiled, but the same issues are present.

Where is the connection for the clicking made inside the script, where is the script located? Can we see the whole script? There could be a lot of things like wrong references and such causing this behavior

https://pastebin.com/gcuZE0V9 < this is the full script from the LocalScript, the full script of the FireAllClients script is found above, and that’s in its full form.

The location of the script is here:
image

while the FireAllClients script is in ServerScriptService.

I’ve been able to solve the issue.

Put your Screens folder in a ScreenGui with ResetOnSpawn disabled.

The reasoning behind why this happens is every time a player dies, all screen gui contents with “ResetOnSpawn” set to false are kept and everything else is removed. Then, the new contents of the playerGui (that do not already exist) are cloned in.

As long as your billboard gui is not directly patented to the playerGui (starts in starterGui), you will be fine, as long as that object has ResetOnSpawn set to false as well.

This works, thank you! Also, thank you to everyone that contributed and helped get this working, it means a lot. :slight_smile:

Uh, what do you mean by this? The only purpose of StarterGui is for the server to clone child objects into a player’s PlayerGui when their character spawns. The location has nothing to do with the behaviour of ResetOnSpawn. Whether you parent it directly to PlayerGui or not, ResetOnSpawn will prevent the Gui from being destroyed when the character respawns.

Are you sure you’re reconnecting the function whenever the player respawns?

The OP’s issue has been solved.

1 Like