Problem with my script : RBXScriptSignal

Hi! I’m having a problem with my script, here’s the output : ServerScriptService.GameScript:35: attempt to call a RBXScriptSignal value

The script :

if chosenChapter.Name == "Chapter One" then
	game.ReplicatedStorage.Events.CloneCutscene.OnServerEvent()
end

The second script :

game.ReplicatedStorage.Events.CloneCutscene.OnServerEvent:Connect(function(player)
	if player.PlayerGui:FindFirstChild("Cutscene") == nil then
		local Clones = game.ReplicatedStorage.Cutscenes.Chapter1:Clone()
		Clones.Parent = player.PlayerGui
	end
end)
1 Like

Neither of those scripts are sending any data through the RemoteEvent, they both are listening for information.

so what do I do???

Instead of .OnServerEvent() do :FireAllClients().

RemoteEvent API Reference

And your Other script should have .OnClientEvent instead of .OnServerEvent()

You are calling an event without a connection. Remote events have a function known as :FireServer(), this will call the OnServerEvent in script 2.

Except I think the 2nd script is the local script.

No, the second script isn’t a local script

Which script is local and which one is the server? Are they both server?

they both server (30 characters)

Alright so are you using a BindableEvent? Because that is what you need to use.

You shouldn’t be editing PlayerGui on the server. Use :FireAllClients() or :FireClient(player) on the server, then use .OnClientEvent() on your client to pick up the call.

no (30characters)…

Already tried it, it doesn’t work, it tells me it only works for local scripts.

What @Tom_atoes said is true and you should be editing GUIs on the client. It is much easier to manage. The issue is your syntax is not correct with RemoteEvents since you’re trying to use them like a BindableEvent.

You can only call .OnClientEvent on the client (local scripts), and .OnServerEvent on the server.

but the two scripts I’m using are both scripts.

basic I just want to duplicate a script in the playergui but it’s complicated with a Script

Why are you trying to duplicate a script?

because this script only works in the PlayerGui, and I want the script to duplicate this at a certain time

Well the begin, the first script is where the error is:

game.ReplicatedStorage.Events.CloneCutscene.OnServerEvent() -- you tried to call it with the brackets

Therefore it should be:

game.ReplicatedStorage.Events.CloneCutscene.OnServerEvent:Connect()

However through reading your trying to fire the server locally (should be in a local script)

-- so instead do this
if chosenChapter.Name == "Chapter One" then
	game.ReplicatedStorage.Events.CloneCutscene:FireServer(1)
end

New second script then to handle this:

game.ReplicatedStorage.Events.CloneCutscene.OnServerEvent:Connect(function(player, scene)
	if scene == 1 then
		local Clones = game.ReplicatedStorage.Cutscenes.Chapter1:Clone()
		Clones.Parent = player.PlayerGui
	end
end)