Hey Roblox devs. Excuse me if I’m in the wrong section. I went to the “test” tab in roblox studio and started a server with 2 players. The thing is, neither player could interact with anything. I have a data store system, and that didn’t get transfered, which I know why it didn’t but it could mean something. I have proximity prompts, and you could not click them. I also have a menu gui and none of the buttons worked when you clicked them. Could this be a roblox problem or could it have something to do with my game?
When I test the game with one player, everything works how it’s supposed to. I’m thinking it might be something with my datastore script, because the script detects whether there’s 1 player or more than 1 player in the game. I have it so that if there’s more than 1 player it cuts some data from being loaded, since I’m making a campaign and if you have a squad with 1 person that is on level 3 and the other players are on level 1, it won’t work properly since all squad members must be on the same level. I hope that makes sense.
I don’t really know why the datastore wouldn’t work for having multiple players in the server, since it’s the exact same code for when there’s one player just minus the campaign level and some other values.
Here is the script for when there’s more than 1 player:
elseif playersInGame > 1 then
local leaderstats = Instance.new("Folder", player)
leaderstats.Name = "leaderstats"
local Coins = Instance.new("IntValue", leaderstats)
Coins.Name = "Coins"
local XP = Instance.new("IntValue", leaderstats)
XP.Name = "XP"
local Level = Instance.new("IntValue", player)
Level.Name = "Level"
local Rank = Instance.new("IntValue", player)
Rank.Name = "Rank"
local GunsUnlocked = Instance.new("Folder", player)
GunsUnlocked.Name = "GunsUnlocked"
--add each unlockable gun as a bool value
local GunLevels = Instance.new("Folder", player)
GunLevels.Name = "GunLevels"
local BlackoutLevel = Instance.new("IntValue", GunLevels)
BlackoutLevel.Name = "BlackoutLevel"
local MP7Level = Instance.new("IntValue", GunLevels)
MP7Level.Name = "MP7Level"
local playerID = player.UserId
local data = nil
local success, err = pcall(function()
data = PlayerData:GetAsync(playerID)
end)
if success then print("got data") else print("failed to get data") end
if data~= nil then
Coins.Value = data.Coins
XP.Value = data.XP
Level.Value = data.Level
Rank.Value = data.Rank
BlackoutLevel.Value = data.BlackoutLevel
MP7Level.Value = data.MP7Level
print("og player")
else
Coins.Value = 0
XP.Value = 0
Level.Value = 0
Rank.Value = 0
BlackoutLevel.Value = 0
MP7Level.Value = 0
print("new player to game")
end
player:WaitForChild("leaderstats")
TeleportService:GetLocalPlayerTeleportData()
end
end)
Keep in mind this is all under a game.Players.PlayerAdded:Connect(function()