Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

I made a script for my game, but the script isnt working. Can you fix it?

Asked by 2 years ago

So I have been working on a map changer. For some reason, the script wont load the map. Please help me. Also since I'm using a desktop, I've been experiencing problems on this site. Ads popped up by google covering up the ask question button. I had to use inspect element. Hint: i put the map changer script in server storage in the maps folder

while true do
    local msg1 = Instance.new("Message",game.Workspace)
    msg1.Text = "MAP LOADING: Sword fights on the heights (by shedletsky) Game lasts for 2 minutes." 
    wait(2)
    msg1:Destroy()
    script.Parent.swordFights.Sky.Parent = game.Lighting
    script.Parent.swordFights.["Sword Fights on the Heights"].Parent = game.Workspace
    wait(120)
    game.Workspace.["Sword Fights on the heights"]:Destroy()
    game.Lighting.Sky:Destroy()
    local msg2 = Instance.new("Message",game.Workspace)
    msg2.Text = "MAP LOADING: Doomspire Brickbattle (by roblox) Game lasts for 2 minutes." 
    wait(2)
    msg2:Destroy()
    script.Parent.doomMap.Sky.Parent = game.Lighting
    script.Parent.doomMap.["Doomspire Brickbattle"].Parent = game.Workspace
    wait(120)
    game.Workspace.["Doomspire Brickbattle"]:Destroy()
    game.Lighting.Sky:Destroy()
    local msg3 = Instance.new("Message",game.Workspace)
    msg1.Text = "MAP LOADING: Chaos Canyon (by roblox) Game lasts for 2 minutes." 
    wait(2)
    msg1:Destroy()
    script.Parent.chaosCanyon.Sky.Parent = game.Lighting
    script.Parent.chaosCanyon.["Canyon"].Parent = game.Workspace
    wait(120)
    game.Workspace.["Canyon"]:Destroy()
    game.Lighting.Sky:Destroy()
    local msg4 = Instance.new("Message",game.Workspace)
    msg5.Text = "MAP LOADING: Haunted Mansion (by telamon) Game lasts for 2 minutes." 
    wait(2)
    msg5:Destroy()
    script.Parent.hauntedMansion.Sky.Parent = game.Lighting
    script.Parent.hauntedMansion.["Mansion"].Parent = game.Workspace
    wait(120)
    game.Workspace.["Mansion"]:Destroy()
    game.Lighting.Sky:Destroy()
    wait()
    end

Please help.

1 answer

Log in to vote
0
Answered by 2 years ago

Well their are a few problems with this script one of them being that you cant use .[] like this

 game.Workspace.["Mansion"]:Destroy()

you gotta delete the . before the [ to make it work

Another problem with this script is the undeclared msg5, I'm going to leave that in my script because I believe that u have declared that on another part of the script if not then delete msg5.

Solution:

while true do
    local msg1 = Instance.new("Message",game.Workspace)
    msg1.Text = "MAP LOADING: Sword fights on the heights (by shedletsky) Game lasts for 2 minutes." 
    wait(2)
    msg1:Destroy()
    script.Parent.swordFights.Sky.Parent = game.Lighting
    script.Parent.swordFights["Sword Fights on the Heights"].Parent = game.Workspace
    wait(120)
    game.Workspace["Sword Fights on the heights"]:Destroy()
    game.Lighting.Sky:Destroy()
    local msg2 = Instance.new("Message",game.Workspace)
    msg2.Text = "MAP LOADING: Doomspire Brickbattle (by roblox) Game lasts for 2 minutes." 
    wait(2)
    msg2:Destroy()
    script.Parent.doomMap.Sky.Parent = game.Lighting
    script.Parent.doomMap["Doomspire Brickbattle"].Parent = game.Workspace
    wait(120)
    game.Workspace["Doomspire Brickbattle"]:Destroy()
    game.Lighting.Sky:Destroy()
    local msg3 = Instance.new("Message",game.Workspace)
    msg1.Text = "MAP LOADING: Chaos Canyon (by roblox) Game lasts for 2 minutes." 
    wait(2)
    msg1:Destroy()
    script.Parent.chaosCanyon.Sky.Parent = game.Lighting
    script.Parent.chaosCanyon["Canyon"].Parent = game.Workspace
    wait(120)
    game.Workspace["Canyon"]:Destroy()
    game.Lighting.Sky:Destroy()
    local msg4 = Instance.new("Message",game.Workspace)
    msg5.Text = "MAP LOADING: Haunted Mansion (by telamon) Game lasts for 2 minutes."   --UNDECLEARED
    wait(2)
    msg5:Destroy()                                                                      --UNDECLEARED
    script.Parent.hauntedMansion.Sky.Parent = game.Lighting
    script.Parent.hauntedMansion["Mansion"].Parent = game.Workspace
    wait(120)
    game.Workspace["Mansion"]:Destroy()
    game.Lighting.Sky:Destroy()
    wait()
end
0
It still does not work. Can you try another method? Naderssrr 15 — 2y
0
did you try deleting the undeclared variables? preston1196 82 — 2y
0
what do you mean undeclared? Naderssrr 15 — 1y
0
omg i get it now, im so dumb. thanks for helping!! Naderssrr 15 — 1y
Ad

Answer this question