Help With Event

For some reason, the event isn’t firing. Help?

Code In Button:

script.Parent.ClickDetector.MouseClick:Connect(function(player)
	player.isWorking.Value = true
	game.ReplicatedStorage.Jobs.MovieTheaterStart:FireClient(player)
end)

Code In StarterGui:

local textLabel = script.Parent:WaitForChild("Text")

game.ReplicatedStorage.Jobs.MovieTheaterStart.OnClientEvent:Connect(function(player)
	script.Parent.Visible = true
	local function write(object,text)
		for i = 1,#text,1 do
			object.Text = string.sub(text,1,i)
			wait(1)
		end
	end
	write(textLabel, "Congratulations! Seems your movie theater application was accepted! Grab some wooden crates from the back room and touch the snack rack with it to get money!")
end)

Try if your clickdetector is really firing, by adding a print statement to your server script. The remote event seems fine, I guess. You can also try firing it manually to confirm. Note that in your localscript, the OnClientEvent does not receive a player reference (which would just be the localplayer anyway).

1 Like

It is firing as the “player.isWorking.Value = true” does turn to true.

In that case see if the event is not fired at all (again with a print statement), or that you simply can’t see the UI become visible. Perhaps it’s parent is still invisible or it’s outside the screen or so?

Seems it’s just not firing in general. Not quite sure why.

Hmm thats curious… I guess something strange is going on. Are you sure you have only a single item called ‘Jobs’ in replicatedStorage, and only a single MovieTheaterStart as a child of Jobs?

Did you try if this localscript is executed at all, in the first place? By a print outside the function. I’m guessing the script won’t be disabled, but if for example you turn off character spawning it may be that your localscript is never copied from starterGui to PlayerGui (and thus never executes).

If you can’t find any clues of what could be wrong, I would just try making a new localscript, in a new baseplate if you have to, and work your way up from there. It should definitely work, the code you gave seems fine. Good luck!

1 Like

Do you get any errors? I need to see an error to see what is wrong with it.