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

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

Asked by 6 years ago
Edited 6 years ago

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)
0
So you're trying to have one GUI change another GUI on the same client? M39a9am3R 3210 — 6y
0
#Confusing marketmanager1 52 — 6y

3 answers

Log in to vote
2
Answered by 6 years ago

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.

0
Yesterday didn't you tell me to use FireClient()? kittonlover101 201 — 6y
0
Yesterday didn't you tell me to use FireClient()? kittonlover101 201 — 6y
0
Yeah, but on the server. User#19524 175 — 6y
Ad
Log in to vote
1
Answered by 6 years ago

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

0
Does this mean I should change the other script to be OnServerEvent? kittonlover101 201 — 6y
1
What is your OnEvent code? User#19524 175 — 6y
0
OnEvent? kittonlover101 201 — 6y
0
I just added it to the post. kittonlover101 201 — 6y
Log in to vote
-1
Answered by
Scarious 243 Moderation Voter
6 years ago
Edited 6 years ago

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.

0
I am using an event. kittonlover101 201 — 6y
0
Are you using a remoteevent or a bindableevent? Scarious 243 — 6y
0
Yeah, I figured out the error, thanks though. kittonlover101 201 — 6y

Answer this question