You can write your topic however you want, but you need to answer these questions:
- What do you want to achieve? Keep it simple and clear!
I want my player to move like public server
- What is the issue? Include screenshots / videos if possible!
Player can’t move in Private Server only Jump?
- What solutions have you tried so far? Did you look for solutions on the Developer Hub?
i try to make some if statement but i did not work
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
I do not know if there a problem with my leaderstats script, public server is fine and roblox studio is fine
local DataStoreService = game:GetService("DataStoreService")
local formatNumber = require(game:GetService("ServerScriptService"):WaitForChild("Libs"):WaitForChild("FormatNumberAlt"))
local PrivateServerData
local ServerTime
local ServerTimeSave
local PrivateServer = false
--playerData = DataStoreService:GetDataStore(99999999999900000011111111100910101181111111175111111111115111112111111111111111111111111110)
if game.PrivateServerId ~= "" and game.PrivateServerOwnerId ~= 0 then
PrivateServer = true
PrivateServerData = DataStoreService:GetDataStore(game.PrivateServerId)
ServerTimeSave = DataStoreService:GetDataStore('Time')
ServerTime = DataStoreService:GetOrderedDataStore('Time')
end
local s1n1 = "Mercury"
local s1n2 = "Venus"
local s1n3 = "Earth"
local s1n4 = "Mars"
local s1n5 = "Jupiter"
local s1n6 = "Saturn"
local s1n7 = "Uranus"
local s1n8 = "Neptune"
local category = {
s1n1, s1n2, s1n3, s1n4, s1n5, s1n6, s1n7, s1n8
}
local GlobalStore = {}
for _,v in category do
GlobalStore[v] = DataStoreService:GetOrderedDataStore(v)
end
local instance = {}
local instanceAmount = {}
local instAmount = {}
local inAmount = {}
local instanceOneTime = {}
local instancePermanent = {}
_G.speed = false
local saveButton = {}
game.ServerStorage.buttonPurchased.Event:Connect(function(Category, button, purchased, permanent)
if not saveButton[Category] then
saveButton[Category] = {}
end
if not saveButton[Category][button] then
saveButton[Category][button] = {}
table.insert(saveButton[Category][button], button)
table.insert(saveButton[Category][button], purchased)
table.insert(saveButton[Category][button], permanent)
else
if saveButton[Category][button][2] ~= purchased then
saveButton[Category][button][2] = purchased
end
if saveButton[Category][button][3] ~= permanent then
table.remove(saveButton[Category][button], 3)
table.insert(saveButton[Category][button], permanent)
end
end
end)
game.ServerStorage.treeRemove.Event:Connect(function(Category)
wait()
for i, name in category do
if Category == name then
for j = 1, i-1 do
Category = category[j]
if saveButton[Category] then
for i,v in saveButton[Category] do
if i == "start" then
if v[2] == true then
v[2] = false
end
end
if v[3] == false then
saveButton[Category][i] = nil
end
end
end
if game.ServerStorage.oneTime[Category].Value ~= 100 or Category == "Mercury" then
game.ServerStorage.oneTime[Category].Value = 0
end
game.ServerStorage.stats[Category].Value = 0
for i, v in category do
if game.ServerStorage.amount[Category][v].Value > 0 then
game.ServerStorage.allAmount[v].Value /= game.ServerStorage.amount[Category][v].Value
end
game.ServerStorage.amount[Category][v].Value = 0
end
end
end
end
game.ServerStorage.buttonRemove:Fire(saveButton)
end)
local WorldBoost = Instance.new("NumberValue")
WorldBoost.Name = "WorldBoost"
WorldBoost.Value = 1
WorldBoost.Parent = game.ServerStorage
-- create folder for server stats
local leaderstats = Instance.new("Folder")
leaderstats.Name = "stats"
leaderstats.Parent = game.ServerStorage
-- create folder for server amount
local amount = Instance.new("Folder")
amount.Name = "amount"
amount.Parent = game.ServerStorage
-- create folder for server oneTime
local oneTime = Instance.new("Folder")
oneTime.Name = "oneTime"
oneTime.Parent = game.ServerStorage
-- create folder for server permanent
local permanent = Instance.new("Folder")
permanent.Name = "permanent"
permanent.Parent = game.ServerStorage
local allAmount = Instance.new("Folder")
allAmount.Name = "allAmount"
allAmount.Parent = game.ServerStorage
local speed = Instance.new("NumberValue")
speed.Name = "speed"
speed.Value = 16
speed.Parent = game.ServerStorage
local serverTime = Instance.new("NumberValue")
serverTime.Name = "serverTime"
serverTime.Value = 0
serverTime.Parent = game.ServerStorage
for i,v in category do
instanceAmount[v] = Instance.new("Folder")
instanceAmount[v].Name = v
instanceAmount[v].Parent = amount
end
for i, v in category do
for i, k in category do
inAmount[v..k] = Instance.new("NumberValue")
inAmount[v..k].Name = k
inAmount[v..k].Value = 0
inAmount[v..k].Parent = instanceAmount[v]
end
end
for i,v in category do
instance[v] = Instance.new("NumberValue")
instance[v].Name = v
instance[v].Value = 0
instance[v].Parent = leaderstats
instAmount[v] = Instance.new("NumberValue")
instAmount[v].Name = v
instAmount[v].Value = 0
instAmount[v].Parent = allAmount
instanceOneTime[v] = Instance.new("NumberValue")
instanceOneTime[v].Name = v
instanceOneTime[v].Value = 0
instanceOneTime[v].Parent = oneTime
instancePermanent[v] = Instance.new("NumberValue")
instancePermanent[v].Name = v
instancePermanent[v].Value = 0
instancePermanent[v].Parent = permanent
end
local data = nil
local serverTimeDate = nil
local success, errormessage = pcall(function()
if PrivateServer then
serverTimeDate = ServerTimeSave:GetAsync(game.PrivateServerOwnerId)
else
print("Error while getting your ServerTime, or is it your first time here?. This is a private server? ", PrivateServer)
end
end)
if success and serverTimeDate ~= nil then
serverTime.Value = serverTimeDate
end
local success, errormessage = pcall(function()
if PrivateServer then
data = PrivateServerData:GetAsync(game.PrivateServerOwnerId)
--data = playerData:GetAsync(100)
else
print("Error while getting your data, or is it your first time here?. This is a private server? ", PrivateServer)
end
end)
if success and data ~= nil then
for i,v in category do
if data["stats "..v] ~= nil then
instance[v].Value = data["stats "..v]
end
if data["oneTime "..v] ~= nil then
instanceOneTime[v].Value = data["oneTime "..v]
end
if data["permanent "..v] ~= nil then
instancePermanent[v].Value = data["permanent "..v]
end
if data["allAmount "..v] ~= nil then
instAmount[v].Value = data["allAmount "..v]
end
for i, k in category do
if data["amount "..v..k] ~= nil then
inAmount[v..k].Value = data["amount "..v..k]
end
end
end
if data["speed"] ~= nil then
speed.Value = data["speed"]
end
if data["saveBtn"] ~= nil then
saveButton = data["saveBtn"]
end
repeat
wait()
until game.ServerStorage:WaitForChild("buttonLoad")
game.ServerStorage.buttonLoad:Fire(true,saveButton)
print(saveButton)
print("Data successfully loaded!")
_G.speed = true
else
print("Error while getting your data, or is it your first time here?. This is a private server? ", PrivateServer)
warn(errormessage)
repeat
wait()
until game.ServerStorage:WaitForChild("buttonLoad")
game.ServerStorage.buttonLoad:Fire(false,{})
_G.speed = true
end
local dataSave = false
function saveData()
if dataSave == false and PrivateServer == true then
dataSave = true
local data = {}
for i,v in category do
data["stats "..v] = game.ServerStorage.stats[v].Value
data["oneTime "..v] = game.ServerStorage.oneTime[v].Value
data["permanent "..v] = game.ServerStorage.permanent[v].Value
data["allAmount "..v] = game.ServerStorage.allAmount[v].Value
for i, k in category do
data["amount "..v..k] = game.ServerStorage.amount[v][k].Value
end
end
data["speed"] = game.ServerStorage.speed.Value
data["saveBtn"] = saveButton
local success, errormessage = pcall(function()
if PrivateServer then
PrivateServerData:SetAsync(game.PrivateServerOwnerId, data)
--playerData:SetAsync(100, data)
else return
end
end)
if success then
print("Data successfully saved!")
local serverTimeDate
serverTimeDate = game.ServerStorage.serverTime.Value
ServerTimeSave:SetAsync(game.PrivateServerOwnerId, serverTimeDate)
serverTimeDate = ServerTime:SetAsync(game.PrivateServerOwnerId, serverTimeDate)
for _,v in category do
if game.ServerStorage.stats[v].Value > 0 then
local value = game.ServerStorage.stats[v].Value
local storedValue = value ~= 0 and math.floor(math.log(value) / math.log(1.0000001)) or 0
GlobalStore[v]:SetAsync(game.PrivateServerOwnerId, storedValue)
else
GlobalStore[v]:RemoveAsync(game.PrivateServerOwnerId)
end
end
else
print("There was an error while saving the data, or this is a not a private server", PrivateServer)
warn(errormessage)
end
wait(10)
dataSave = false
end
end
game.Players.PlayerRemoving:Connect(function()
if #game.Players:GetPlayers() <= 1 then
saveData()
end
end)
while PrivateServer do
wait(600)
print('ye ye')
saveData()
end
Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.