Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How to send a signal from script to local script ?(Remote Event problem)

I'm trying to create a lever that when clicked will display a GUI frame (specifically Warning TextLabel ). I want to do it using Remote Events, but I can't do it at all. I personally think that I have some error in writing the code because I have already tried all types of options and none of them worked.

This is how i am doing it :

Normal Script

I think this script is okay. Because I tested it with BreakPoint and FireAllClients works. But I am going still show it here just in case

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local remoteEvent = ReplicatedStorage:WaitForChild("WarningEvent")

function open()
	
	remoteEvent:FireAllClients()
	script.Parent.Transparency = 1
	script.Parent.Parent.Lever2.Transparency = 0

end

script.Parent.ClickDetector.MouseClick:Connect(open)

Local Script

I think a problem is somwhere here. This "WarningGui" is actually just a Frame where it is written that you should not press this lever and I am trying to make it visible after clicking.

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local remoteEvent = ReplicatedStorage:WaitForChild("WarningEvent")


local function WarningGui()
	
	game.StarterGui.WarningGui.Frame.Visible = true
end
	


remoteEvent.OnClientEvent:Connect (WarningGui())

I will be very happy for any answer. And if the solution will be very simple, please understand that I am just a beginner and I don't have that kind of skills as others.

Thank you :)

1 answer

Try changing local script to just a script. I had a similar issue and this helped me. Also if this didn't work try removing the remote events, but still make sure the local script is a script.

2 comments

0

Yes it will work then , but the GUI will be showed to a server and not to a player.I already tried that before.

0

Try using PlayerGui variable in your script

This discussion is preserved as it was. New answers, comments, and votes are closed.