Hello, I've been working on my simulator for a while and I got this error:
14:59:05.767 - ServerScriptService.Script:95: Expected ')' (to close '(' at line 68), got 'Players'
The script is inside ServerScriptService, and the Modules folder and InstanceCreator is inside ReplicatedStorage. The Prefabs are not spawning and my leaderstats doesn't save why? Please help
SCRIPT:
local Players = game:GetService("Players") local RS = game:GetService("ReplicatedStorage") local SS = game:GetService("ServerStorage") local DSS = game:GetService("DataStoreService") local RunService = game:GetService("RunService") local ReplicatedModules = RS:WaitForChild("Modules") local InsCreator = require(ReplicatedModules.InstanceCreator) local DataStore = DSS:GetDataStore("Test") function GetRandomCFrame(Part,NewPart) local X, Z = Part.Size.X/2,Part.Size.Z/2 local RX,RZ = math.random(-X,X),math.random(-Z,Z) return Part.CFrame * CFrame.new(RX, {Part.Position.Y + NewPart.Size.Y + 0.3},RZ) end local function PlayerAdded(plr) local leaderstats = InsCreator.create("Folder", {Name = "leaderstats", Parent = plr}) local Tubes = InsCreator.create("IntValue", {Name = "Tubes", Value = 0}) local CURP = InsCreator.create("StringValue", {Name = "CURP", Value = 0}) local Rebirths = InsCreator.create("StringValue", {Name = "Rebirths", Value = 0}) local key = string.format("$s's data",plr.UserId) local success, err = pcall(function() local save = DataStore:GetAsync(key) if save then Tubes.Value = save[1] CURP.Value = save[2] Rebirths.Value = save[3] end end) if success then print(string.format("loaded $s's data",plr.Name)) elseif err then warn(err) end leaderstats.Parent = plr Tubes.Parent = leaderstats CURP.Parent = leaderstats Rebirths.Parent = leaderstats end local function PlayerRemoving(plr) local key = string.format("$s's data",plr.UserId) local ls = plr.leaderstats local success, err = pcall(function() DataStore:SetAsync(key,{ls.Tubes.Value, ls.CURP.Value, ls.Rebirths.Value}) end) if success then print(string.format("saved $s's data",plr.Name)) elseif err then warn(err) end end for a, biome in pairs(workspace:WaitForChild("Bioms"):GetChildren()) do spawn(function() RunService.Heartbeat:Connect(function() for i, tube in pairs(biome.Tubes:GetChildren()) do tube.CFrame = tube.CFrame * CFrame.fromEulerAnglesXYZ(0.02,0.02,0.02) end end) while true do if biome.Settings.MaxTubes.Value > #biome.Tubes:GetChildren() then local TubesToClone = biome.Settings.Tubes:Getchildren() local SelectedTubes = TubesToClone[math.random(1,#TubesToClone)] local NewTube = SS.Prefabs:FindFirstChild(SelectedTubes.Name):Clone() local Amount = math.random(math.floor(NewTube.Value.Value/1.25),math.floor(NewTube.Value.Value*1.25)) NewTube.CFrame = GetRandomCFrame(biome.Baseplate,NewTube) NewTube:WaitForChild("TubeValueGUI").Value.Text = Amount NewTube.Parent = biome.Tubes end end end Players.PlayerAdded:Connect(PlayerAdded) Players.PlayerRemoving:Connect(PlayerRemoving)
I would like lots of helps thanks!
You're missing a ')' at line 92 Players.PlayerAdded:Connect(PlayerAdded)