Ad
Log in to vote
0

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

Asked by 10 days ago
Edited 10 days 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 3007 — 10d
0
#Confusing marketmanager1 39 — 10d

3 answers

Log in to vote
2
Answered by
incapaz 3232 Moderation Voter
10 days 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 48 — 10d
0
Yesterday didn't you tell me to use FireClient()? kittonlover101 48 — 10d
0
Yeah, but on the server. incapaz 3232 — 10d
Ad
Log in to vote
1
Answered by 10 days 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 48 — 10d
1
What is your OnEvent code? incapaz 3232 — 10d
0
OnEvent? kittonlover101 48 — 10d
0
I just added it to the post. kittonlover101 48 — 10d
Log in to vote
-1
Answered by
Scarious 203 Moderation Voter
10 days ago
Edited 10 days 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 48 — 10d
0
Are you using a remoteevent or a bindableevent? Scarious 203 — 10d
0
Yeah, I figured out the error, thanks though. kittonlover101 48 — 10d

Answer this question