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)
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.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
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.