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
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
instead as that will actually give the variable e a definition.