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

FireClient() Can Only Be Used By Server!? [Not Solved]

Here is my issue. This script is in a Local Script. I know you're supposed to put it in a script, but if I do that then the script doesn't even register. So I need help. Also I CANNOT use FireServer(), because im changing guis in the other script. If you know how to fix this, please help. Thanks!

Player = game.Players.LocalPlayer
script.Parent.Text=tostring(script.Parent.ItemName.Value)..": Gamepass"

script.Parent.MouseButton1Click:connect(function()
	game.ReplicatedStorage.Events.Trails.CustomTrailEvent:FireClient(Player, script.Parent.Parent.Parent.Parent.Parent.Parent.Name)
end)

PS: Trying to make my game FE compatible.

OnEvent Code For icapaz:

game.ReplicatedStorage:WaitForChild("Events").Trails.CustomTrailEvent.OnClientEvent:Connect(function(guiname)
	local Player = game.Players.LocalPlayer
	local playerid = Player.UserId
	local id = 4785126
	print(guiname)

2 comments

0

So you're trying to have one GUI change another GUI on the same client?

0

#Confusing

3 answers

✓ Accepted answer

###You can’t use FireClient from a LocalScript. You can only call from the server. Just how the client can fire to the server, the server fires to the client.

3 comments

0

Yesterday didn't you tell me to use FireClient()?

0

Yesterday didn't you tell me to use FireClient()?

0

Yeah, but on the server.

Well I am pretty new to FE myself but from what it looks like, you can't fire a client to another client or to the server. It has to be from the server to the client.

Server to Client:

game.ReplicatedStorage.Events.Trails.CustomTrailEvent:FireCleint(Player, script.Parent.Parent.Parent.Parent.Parent.Parent.Name)

Client to Server:

game.ReplicatedStorage.Events.Trails.CustomTrailEvent:FireServer(Player, script.Parent.Parent.Parent.Parent.Parent.Parent.Name)

:FireClient() is only used to communicate from the server to the client and :FireServer() is only used to communicate from the client to the server

More info on this YT video: https://www.youtube.com/watch?v=4Dc_bri9mjs&t

4 comments

0

Does this mean I should change the other script to be OnServerEvent?

1

What is your OnEvent code?

0

OnEvent?

0

I just added it to the post.

FireClient can only be used by a script which is in ServerScriptService. If you are trying to communicate between the same client, consider using a BindableEvent, if you are trying to communicate between different clients, first call to the server, then have the server call to another client.

3 comments

0

I am using an event.

0

Are you using a remoteevent or a bindableevent?

0

Yeah, I figured out the error, thanks though.

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