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
else
Store:SetAsync(User.UserId, true)
local char = User.Character or User.CharacterAdded:Wait()
print("ok server fshould have fired")
wait(2)
game.ReplicatedStorage.StartTutorial:FireClient(User)
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.
end)
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
r.OnClientEvent:Connect(function(e)
print(e.Name)
print("client Fired Initiating tutorial")
local plot = char.Plot.Value
print(plot.Name)
end)
If you know why please help

2 comments
In the first script does "i mean client" get printed??
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.