Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 2 years ago

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

Log in to vote
0
Answered by 2 years ago
Edited 2 years ago

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.

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. Zubo666 0 — 2y
0
Try using PlayerGui variable in your script theking66hayday 841 — 2y
Ad

Answer this question