Hi guys! I have this function that displays two guis and teleports the players - for some reason it runs twice? I tested it with printing and it confirmed that it ran twice.

I used Ctrl-F to search the script for any other times the function is called but it is only called once! Any ideas?! Thanks

function oilrig() 
wait(2)
for i, v in pairs(game.Players:GetPlayers()) do
if v.PlayerGui.MapChosenGui.MapChosen.StarThree.Visible == true then
v.PlayerGui.MapChosenGui.MapChosen.StarThree.Visible = false
end
if v.PlayerGui.MapChosenGui.MapChosen.StarTwo.Visible == false then
v.PlayerGui.MapChosenGui.MapChosen.StarTwo.Visible = true
end
v.PlayerGui.MapChosenGui.MapChosen.MapCreator.Image = "http://www.roblox.com/Thumbs/Avatar.ashx?x=100&y=100&Format=Png&username=BloxaBrick"
v.PlayerGui.MapChosenGui.MapChosen.MapPic.Image = "rbxassetid://257029436"
v.PlayerGui.MapChosenGui.MapChosen.MapCreatorName.Text = "By BloxaBrick"
v.PlayerGui.MapChosenGui.MapChosen.MapName.Text = "Oil Rig"
v.PlayerGui.MapChosenGui.MapChosen.Blurb.Text = "Fun Fact: When the map had a bug(now patched), InceptionTime managed to get out an unofficial exit on stream!"
wait(0.5)
game.Workspace.DisplayMapChosen.Value = true
wait(4)
game.Workspace.DisplayMapChosen.Value = false

for i,v in pairs(game.Players:GetPlayers()) do
v.PlayerGui.MapChosenGui.MapRecord.MyTime.Text = v.PlayerModel.OilRigTime.Value
end 
game.Workspace.DisplayRecordChosen.Value = true
wait(4)
game.Workspace.DisplayRecordChosen.Value = false
wait(2)
local target7 = CFrame.new(721.84, 186.6, -42.85) --could be near a brick or in a new area
for i, player in pairs(game.Players:GetPlayers()) do

if player.Character and player.Character:FindFirstChild("Torso") and player.TeamColor == BrickColor.new("Bright blue") then
player.Character.Torso.CFrame = target7 + Vector3.new(i*4,3,i/4)
end
end
local target8 = CFrame.new(799.2, 174.6, 120.6) for i, player in pairs(game.Players:GetPlayers()) do

if player.Character and player.Character:FindFirstChild("Torso") and player.TeamColor == BrickColor.new("Bright green") then

player.Character.Torso.CFrame = target8 + Vector3.new(i*4,3,i/4)
end
end
h.Text = ""
end
end

This is where I call the function:

if game.Workspace.MapChosenByPlayer.Value == "OilRig" then
			game.Workspace.Announcer.Text = "Loading map..."
				newrand2 = game.ServerStorage.Maps.OilRig:Clone()
		       newrand2.Parent = game.Workspace
		wait(5)
		game.Workspace.Announcer.Text = ""
		       game.Workspace.ChooseMap.Value = false
		       oilrig() -- CALLING IT HERE
			   game.Workspace.MapChosenByPlayer.Value = ""
end

4 comments

0

I did CTRL+F And Couldn't find where it was being called at all. If you didn't post where its being called then post it. Most likely you have a for.

0

Posted it :)

0

You have not provided sufficient information for a solution.

0

What else do I need to provide? :)