I have been utterly clueless as to why this is occurring. Basically, I’ve been working on my script for over 5 months now, and had the base of it done a long time ago and never touched it since. At the beginning, when the player joins, I send the data over to the client via a remote event:
Players.PlayerAdded:Connect(function(Plr)
local MainDataStore = Datastore2("MainDataStore",Plr)
local ResetDataForTesting = MainDataStore:Set(DefaultStats) -- remove before release
local PlayerData = MainDataStore:Get(DefaultStats)
if PlayerData.DatastoreVersion ~= CurrentDatastoreVersion then -- if the user's current datastore is not up to the changed datastore, it will add the extra value to their datastore
print(PlayerData.DatastoreVersion , CurrentDatastoreVersion)
PlayerData = MainDataStore:GetTable(DefaultStats)
print(PlayerData)
end
local function callRemote (Value)
ReplicatedStorage.Events.RE:FireClient(Plr,"REUSED",Value)
print("Updated")
end
Instance.new("Animator",workspace:WaitForChild(Plr.Name).Humanoid)
RE:FireClient(Plr,"PlayerJoined")
callRemote(PlayerData)
print(Plr)
MainDataStore:OnUpdate(callRemote)
PlayerDataScriptScope[Plr.UserId] = PlayerData
end)
(Take note that this does use Datastore2)
This worked fine for the longest time, on the client, I retrieve both “REUSED” and “PlayerJoined” simultaneously:
RE.OnClientEvent:Connect(function(Key,Var1,Var2,Var3)
if Key == "REUSED" then
PlayerStats = Var1
print(PlayerStats)
if PlayerStats.FirstTime == true then
Player.PlayerGui.PC_UIS.Frame.Interface.Follows.Text = 0
else
Player.PlayerGui.PC_UIS.Frame.Interface.Follows.Text = PlayerStats.Followers
end
Player.PlayerGui.PC_UIS.Frame.Interface.Likes.Text = PlayerStats.Likes
Player.PlayerGui.PC_UIS.Frame.Interface.Views.Text = PlayerStats.Views
elseif Key == "PlayerJoined" then -- Starts the intro sequence
print("Here")
controls:Disable()
camera.CameraType = "Scriptable"
camera.CFrame = CFrame.new(workspace.CameraAngles.Intro.Position)*CFrame.Angles(math.rad(workspace.CameraAngles.Intro.Orientation.X),math.rad(workspace.CameraAngles.Intro.Orientation.Y),math.rad(workspace.CameraAngles.Intro.Orientation.Z))
workspace.BackupDancer1.Humanoid.Animator:LoadAnimation(ReplicatedStorage.NPCAnims.Dance):Play()
workspace.BackupDancer2.Humanoid.Animator:LoadAnimation(ReplicatedStorage.NPCAnims.Dance):Play()
game.Lighting.Blur.Enabled = true
game.ReplicatedStorage.Music.Intro:Play()
Player.PlayerGui.IntroScreen.Logo.Position += UDim2.fromScale(0,-2)
Player.PlayerGui.IntroScreen.Buttons.Position += UDim2.fromScale(-2,0)
local Logo = TweenService:Create(Player.PlayerGui.IntroScreen.Logo,TweenInfo.new(2),{Position = UDim2.fromScale(0.357,-0.052)})
Logo:Play()
Logo.Completed:Wait()
local Buttons = TweenService:Create(Player.PlayerGui.IntroScreen.Buttons,TweenInfo.new(2),{Position = UDim2.fromScale(0.344,0.339)})
Buttons:Play()
end
Again, without issue for the longest time, never touched it once. Now, suddenly, my client script refuses to retrieve anything fired from the server. I have printed and ensured that the server is doing it’s part in firing to the client, and I debugged the client to no avail.
I even tested if the code was yielded for some strange reason - but it isn’t.
I’m quite frusterated since this ruins my entire game now, and I really don’t wish to start over, so any help would be great.
If you are needing more information, please let me know.
EDIT: It works at random intervals, like 1 in 20 times it will retrieve it which is also very weird to me