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

Issue with client not receiving signal from server when it should?

Asked by
wswswff 39
1 year ago

I'm making a tutorial system. The server detects if the player has joined for the first time. If so, it fires a remote event that is in replicated storage. Here is the server code:

local Users, DataService = game:GetService("Players"), game:GetService("DataStoreService")
local Store = DataService:GetDataStore("IsPlayersNewhWujAwadfghjkws2") -- we make a store storing if they played already or not.

Users.PlayerAdded:Connect(function(User) -- this is when they join!
     -- DataStoreService (DSS) uses keys to store data. Using the player's userid makes all keys unique and won't mess with the code!
    if Store:GetAsync(User.UserId) then

        Store:SetAsync(User.UserId, true)
        local char = User.Character or User.CharacterAdded:Wait()
        print("ok server fshould have fired")
        print("i mean client")
    end -- this will stop the code if they already joined the game before!
    -- if this data exists when they next join then it will stop the code. but since it does exist it will then add a value(s) for next time.

I the client does not print while the server doesClient:

local r = game.ReplicatedStorage.StartTutorial
local plr = game.Players.LocalPlayer
local char = plr.CharacterAdded:Wait() or plr.Character
    print("client Fired Initiating tutorial")
    local plot = char.Plot.Value

If you know why please help

In the first script does "i mean client" get printed?? 666_brithday 103 — 1y
in the client e doesn't exist. OnClientEvent's callback function doesn't have any parameters except if you added more parameters to FireClient other than User. T3_MasterGamer 2189 — 1y

1 answer

Log in to vote
Answered by
manith513 121
1 year ago

In the local script, onclientevent does not have a callback or any parameters you are sending. Since the first parameter of fireclient is who you're sending it to, it doesn't send anything else with it. Try doing

FireClient(User, User.Name) 

instead as that will actually give the variable e a definition.


Answer this question