So Basically I’m trying to make a minigame script but for some reason the status bar wont even do anything it just says 0 all of the time, and the minigame doesn’t even work, Its always supposed to be a lava thing but it doesn’t teleport me at all.
Main Script
local s = script.Status
local vals = game.ReplicatedStorage.vals
t = 0
while true do
t = 15
repeat
t = t-1
s.Value = "Intermission.."..t
wait(1)
until t == 0
s.Value = "Game starting!"
wait(2)
local mapselect = game.ReplicatedStorage.Gammes:GetChildren()
local choose = map.random(1,#mapselect)
curnum = 0
for i =1,#mapselect do
curnum = curnum +1
if curnum == choose then
mapselect[i]:Clone().Parent = workspace
curmap = mapselect[i].Name
s.Value = "The Map you will play on is "..mapselect[i].Name
end
end
wait(3)
local plrs = game.Players:GetChildren()
for i = 1,#plrs do
local num = math.random(1,8)
plrs[i].Character.Head.CFrame = CFrame.new(workspace.Telaports["Part"..num].Position)
plrs[i].Charatcer.Parent = workspace.Ingame
end
t=100
repeat
t = t-1
s.Value = t.." seconds left..."
wait(1)
until t ==0 or vals.Winner.Value ~= ""
if vals.Winner.Value ~= "" then
s.Value = vals.Winner.Value.. "Has won!"
vals.Winner.Value = ""
else
s.Value = "No one has won "
wait(3)
local ingame = workspace.Ingame:GetChildren()
for i =1,#ingame do
local plr = game.Players:GetPlayerFromCharacter(ingame(i))
plr.LoadCharacter()
workspace[curmap]:Destroy()
end
end
end
Winner Pad Script
script.Parent.Touched:Connect(function(hit)
local h = hit.Parent:FindFirstChild("Humanoid")
if (h~=nil)then
game.ReplicatedStorage.vals.Winner.Value = hit.Parent.Name
script.Parent:Destroy()
end
end)
Output
07:32:15.055 Gammes is not a valid member of ReplicatedStorage "ReplicatedStorage" - Server - Main:13
07:32:15.055 Stack Begin - Studio
07:32:15.055 Script 'MapsFolder.Main', Line 13 - Studio - Main:13
07:32:15.056 Stack End - Studio
07:55:46.871 MapsFolder.Main:14: attempt to index nil with 'random' - Server - Main:14
07:55:46.871 Stack Begin - Studio
07:55:46.871 Script 'MapsFolder.Main', Line 14 - Studio - Main:14
07:55:46.872 Stack End - Studio
@StarJ3M it would be better if you put all the parts of the map in a single model and put it in the workspace, insert into the model a part to make the teleport position and then you change the last line of code i wrote with this:
local getMap = game.Workspace:FindFirstChild(mapChoosen)
for _, players in pairs(game.Players:GetChildren()) do
players.Character:WaitForChild("HumanoidRootPart").CFrame = getMap:FindFirstChild("TeleportPart").CFrame --Change "Teleport Part" with the name of the teleport Part you made so everyone will be teleported in that map
end
Ok, So I test ran it and then it telaported me to the map and cloned it and put it in workspace, but the status still is just 0. When I died and Didnt finish the map this happened.
08:27:36.974 Charatcer is not a valid member of Player "Players.NubblyFry" - Server - Main:29
08:27:36.975 Stack Begin - Studio
08:27:36.975 Script 'MapsFolder.Main', Line 29 - Studio - Main:29
08:27:36.975 Stack End - Studio
08:30:07.487 Disconnect from ::ffff:127.0.0.1|58804 - Studio
Okay lets see some stuff in you code that has issues i know you already fixes some but lets look at them again:
local s = script.Status
local vals = game.ReplicatedStorage.vals
t = 0
while true do
t = 15
repeat
t = t-1
s.Value = "Intermission.."..t
wait(1)
until t == 0
s.Value = "Game starting!"
wait(2)
local mapselect = game.ReplicatedStorage.Games:GetChildren()
local choose = map.random(1,#mapselect)
curnum = 0
for i =1,#mapselect do
curnum += 1 --------simplify that
if curnum == choose then
mapselect[i]:Clone().Parent = workspace
curmap = mapselect[i].Name
s.Value = "The Map you will play on is "..mapselect[i].Name --- you basically doing a loop on a Math random which is already choosen no need to loop it
end
end
wait(3)
local plrs = game.Players:GetChildren()
for i = 1,#plrs do
local num = math.random(1,8)
plrs[i].Character.Head.CFrame = CFrame.new(workspace.Telaports["Part"..num].Position) --- you cant say Head.Cframe but Neck.C0 this is breaking your game
plrs[i].Charatcer.Parent = workspace.Ingame
end
t=100
repeat
t = t-1
s.Value = t.." seconds left..."
wait(1)
until t ==0 or vals.Winner.Value ~= ""
if vals.Winner.Value ~= "" then
s.Value = vals.Winner.Value.. "Has won!"
vals.Winner.Value = ""
else
s.Value = "No one has won "
wait(3)
local ingame = workspace.Ingame:GetChildren()
for i =1,#ingame do
---local plr = game.Players:GetPlayerFromCharacter(ingame(i)) -- not getplayerfrom character but character from player which isnt supported so here remove this line also the character isnt in the workspace yet so it cant be get character from player
plr.LoadCharacter()
workspace[curmap]:Destroy()
end
end
end