I use this script in my intro to test whether the player has picked their gender or not, so far on my account there has been no issues but for other players this part doesnt work/load?
script.Parent.RemoteFunction.OnServerInvoke = function(plr)
local datastore = DataStore2("Gender",plr)
repeat wait(0.3) until datastore:Get() ~= nil
local gender = datastore:Get()
return gender
end
I added the repeat wait to see if its just returning nil for awhile but its just not seeming to load?
You should try putting the functions inside a coroutine, the wait is on server so it will wait for everyone, if you put it inside a coroutine, it will run the function everytime for different players:
script.Parent.RemoteFunction.OnServerInvoke = function(plr)
coroutine.wrap(function()
local datastore = DataStore2("Gender",plr)
repeat wait(0.3) until datastore:Get() ~= nil
local gender = datastore:Get()
return gender
end)
end
I tried this but it still isn’t knowing the correct value, im wondering if because its also loading the datastore as stats inside the player if thats interfering? but why isn’t it doing it on my account?
when i say isn’t knowing the correct value, its cuz in a client script
play.Frame.Title.MouseButton1Down:Connect(function()
if played == false then
played = true
local Gender = script.Parent.RemoteFunction:InvokeServer(player)
print(Gender)
if Gender == "NoGender" then
customcam = true
MoveCamera(game.Workspace.Cameras.CameraPart, game.Workspace.Cameras.GenderCam, 0.5, Enum.EasingStyle.Sine, Enum.EasingDirection.Out)
frames.Settings.Visible = false
frames.Credits.Visible = false
script.Parent.GenderFrame.Frame.Visible = true
folder.Rig.HumanoidRootPart.CFrame = CFrame.lookAt(folder.Rig.HumanoidRootPart.Position, Vector3.new(game.Workspace.Cameras.GenderCam.Position.X,game.Workspace.Cameras.GenderCam.Position.Y,game.Workspace.Cameras.GenderCam.Position.Z))
else
but its always doing else even tho the player has “NoGender”
it wasnt before, because it was working on me, nogender and gender, but other players it just was not loading, so it didnt get to come back as anything?