Why is gui not disabling on enable = false

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local RevengeEvent = ReplicatedStorage:WaitForChild("RevengeEvent")


RevengeEvent.OnServerEvent:Connect(function(player)
	-- Add your logic here to handle the revenge event
	print(player.Name .. " triggered the revenge event!")
	-- Example: Reduce player's health
	local frametext = player.PlayerGui.DialogGui.DialogFrame.text
	if frametext then


		frametext.Text = "in return..."
		wait(2)
		frametext.Text = "run down the basement"
		wait(2)
		frametext.Text = "3"
		wait(1)
		frametext.Text = "2"
		wait(1)
		frametext.Text = "1"
		wait(1)
		frametext.Text = "run"
		wait(1)
		
		player.PlayerGui.DialogGui.Enabled = false

		local killer = game.ServerStorage.killer:Clone()
		killer.Parent = workspace
		killer:PivotTo(workspace.killerspawn.CFrame)
		game.Workspace.Dummy:Destroy()
		game.Workspace.basementdoor:Destroy()
	end
end)

this is my script, and on line 26 u can see player.PlayerGui.DialogGui.Enabled = false, however it doesnt work, how do i fix it

I told you it has to be RevengeEvent.OnServerInvoke = function(player) when you changed it to a remote function a while ago…

1 Like

uhhhhhhhhhhhhhh about that, does it have to be like that for it to work

Yes it does. That’s just how remote function syntax works…

isnt there any other way to hide it without remote function bcuz it doesnt work for some reason

Wait, why not just switch to a remote event? Am i missing something?

Ok try this rework. Switch RevengeEvent back to a remote event (syntax’s back to :FireServer and OnServerEvent etc.) and then in the local script…

local RevengeEvent = ---...
RevengeEvent:FireServer()
wait(8.5)
game.Players.LocalPlayer.PlayerGui.DialogGui.Enabled = false

While you prefer using remote events and this script is adjusted to that, i suggest you to read up the functions since they will be useful in the future if you continue to script roblox studio

i am using a remote event but he insists on using a remote function but that doesnt work for me

1 Like

If you’re interested here are the roblox documentation on remote functions

that fires the remote event after 8.5 seconds of joining…

i read that it has no information on this unless i missed somthing

1 Like

Fire the client whenever you want. Then, recieve it on the client using .OnServerEvent and it should work

You can also try setting the visible to false instead of enabled. Sometimes this works better, not exactly sure why.

I got to go but i hope you figure it out!

you could just use a remoteevent that fires back to the player so that the client itself disables it (onclientevent)