Hello, I have problem with 2 script. I need to connect them in 1 script, which work. Here is Checkpoint System script:
Var = script.Parent.Settings function SetPoint(Block, hit, ShowS, AllowBT) print("a") if hit.Parent:findFirstChild("Humanoid")~=nil then print("b") if game.Players:findFirstChild(hit.Parent.Name)~=nil then print("player found") P = game.Players:findFirstChild(hit.Parent.Name) if P:findFirstChild("leaderstats")==nil and ShowS == true then print("making stats") a = Instance.new("Model") a.Name = "leaderstats" b = Instance.new("IntValue") b.Value = Block.StageNum.Value b.Name = "Stage" b.Parent = a a.Parent = P elseif P:findFirstChild("Stage")==nil and ShowS == false then b = Instance.new("IntValue") b.Value = Block.StageNum.Value b.Name = "Stage" b.Parent = P end if AllowBT == true then print("backtrack true") if P:findFirstChild("leaderstats")~=nil then P.leaderstats.Stage.Value = Block.StageNum.Value elseif P:findFirstChild("Stage")~=nil then P.Stage.Value = Block.StageNum.Value end elseif P:findFirstChild("leaderstats")~=nil then if Block.StageNum.Value >= P.leaderstats.Stage.Value then P.leaderstats.Stage.Value = Block.StageNum.Value end elseif P:findFirstChild("Stage")~=nil then if Block.StageNum.Value >= P.Stage.Value then P.Stage.Value = Block.StageNum.Value end end end end end A = script.Parent.CheckPoints:GetChildren() for i = 1, #A do if A[i].ClassName == "Part" then A[i].Touched:connect(function(part) SetPoint(A[i], part, Var.ShowStage.Value, Var.AllowBackTrack.Value) end) end end function Respawn(B, User) print("respawning") F = script.Parent.CheckPoints:GetChildren() Available = {} if User:findFirstChild("leaderstats")~=nil then if User.leaderstats:findFirstChild("Stage")~=nil then S = User.leaderstats:findFirstChild("Stage") end elseif User:findFirstChild("Stage")~=nil then S = User:findFirstChild("Stage") end for e = 1, #F do if F[e].StageNum.Value == S.Value then Available[#Available+1] = F[e] end end if #Available > 0 then print("c") Chosen = Available[math.random(1, #Available)] repeat wait() until B:findFirstChild("Torso")~=nil B.Torso.CFrame = CFrame.new(Chosen.Position.X, Chosen.Position.Y+3+(Chosen.Size.Y/2), Chosen.Position.Z) print("d") else print("no spawns available") end end function Register(P) --P:WaitForDataReady() P.CharacterAdded:connect(function(char) Respawn(char, P) end) if Var.ShowStage.Value == true then a = Instance.new("Model") a.Name = "leaderstats" b = Instance.new("IntValue") b.Value = Var.StartAt.Value b.Name = "Stage" b.Parent = a a.Parent = P else b = Instance.new("IntValue") b.Value = Var.StartAt.Value b.Name = "Stage" b.Parent = P end end game.Players.PlayerAdded:connect(function(player) Register(player) end)
Here is Points Leaderboard GUI:
game.Players.PlayerAdded:connect(function(player) local leaderstats = Instance.new("IntValue",player) leaderstats.Name = "leaderstats" local points = Instance.new("NumberValue",leaderstats) points.Name = "Points" points.Value = 0 local P = game.StarterGui.Points.Frame.Point P.Text = " "..points.Value end)
So can someone connect it?