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

[SOLVED] LocalScript not receiving signals from Serverscript when fired event, how come?

Asked by 4 years ago
Edited 4 years ago

Update: Hello guys, i've solved the problem by myself. Thanks to those who tried to help :)

Explanation (Updated): So I'm trying to tween the position of the ScreenGui through RemoteEvents and i need this ScreenGui to pop up every time a player clicked on a TextButton on a SurfaceGui In a Monitor "Screen".

Therefore I have 2 scripts

First script is named "MonitorScreenButtonServer". It is a ServerScript as you can tell from the name and is located in a Model Named "Monitor4". Direction: Workspace > Monitor4(Model) > Model(Model) > Model(Model) > MonitorScreen(Part) > SurfaceGui(SurfaceGui) > TextButton(TextButton) > MonitorScreenButtonServer.

Second script is named "MonitorScreenButtonLocal". It is a LocalScript. It is located at where "MonitorScreenButtonServer" is located in.

Here are my scripts:

MonitorScreenButtonServer:

local MonitorScreenButtonEvent = game:GetService("ReplicatedStorage"):WaitForChild("EventsFolder"):WaitForChild("MonitorScreenButtonEvent")

game.Players.PlayerAdded:Connect(function(Player)
    MonitorScreenButtonEvent:FireClient(Player)
    print("FiredClient")
end)

MonitorScreenButtonLocal:

local MonitorScreenButtonEvent = game:GetService("ReplicatedStorage"):WaitForChild("EventsFolder"):WaitForChild("MonitorScreenButtonEvent")
local MonitorTextButton = game.Workspace:WaitForChild("Monitor4"):WaitForChild("Model"):WaitForChild("Model"):WaitForChild("MonitorScreen"):WaitForChild("SurfaceGui"):WaitForChild("TextButton")
local Clicked = false

MonitorScreenButtonEvent.OnClientEvent:Connect(function(Player)
    print("MonitorScreenButtonEvent Received Signal")
    if Clicked == false then
        Clicked = true
        print("Clicked")
        local PatientCardIssueFrame = Player:WaitForChild("PlayerGui"):WaitForChild("PatientCardIssueScreenGui"):WaitForChild("ScrollingFrame")
        PatientCardIssueFrame:TweenPosition(UDim2.fromScale(0.302, 0.268), "In", "Sine", 1.5)
        Clicked = false
    end
end)

This script is simple. But i tried to make it work in many ways, to no avail. The problem here is with the "MonitorScreenButtonLocal" script from my understanding when i debug the script. Everything worked well in "MonitorScreenButtonServer" but when it comes to the LocalScript, after the ServerScript fired the event, the LocalScript did not receive any signal from the ServerScript...

0
is the : supposed to be in line 9? or should it be a . BradNewTypical 232 — 4y
0
Hello, no, i tried for a more advanced debug just now. The problem is that the ServerScript fires the remote event, but the LocalScript did not receive the signal. guest_20I8 266 — 4y
0
ok BradNewTypical 232 — 4y
0
Do (Solved) and it will act as an answer has been accepted. You should also put your solution in the post. zandefear4 90 — 4y

Answer this question