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

For some reason this script is not working although there are no errors in any logs? [closed]

Asked by 7 years ago

I checked for errors and I can't find any. Here is the script.

script.Parent.Dialog.DialogChoiceSelected:connect(function(player,choice)
    print(choice.Name)
    print(player.Name)
    if choice.Name == "Shack" then
    local HomeStats = player.HomeStats
    local PlotN = player.HomeStats.PlotN    

    if PlotN.Value == 0 then
    print(HomeStats.PlotN.Value)
        choice.ResponseDialog = "You must claim a plot before you can load your home"
        player.PlayerGui.NotifGui.FrameB.Notification.Text = "You must claim a plot before you can load your home"
        wait(5)
        player.PlayerGui.NotifGui.FrameB.Notification.Text = ""
        choice.ResponseDialog = "Home Loaded."
    else
    if HomeStats.HasHome.Value == true then
    if HomeStats.HomeType.Value == "Shack" then
        if game.Workspace:FindFirstChild("Shack_"..player.Name) == nil and game.Workspace:FindFirstChild("Surburban_"..player.Name) == nil and game.Workspace:FindFirstChild("Modern_"..player.Name) == nil then
        local Home = game.Lighting["Home-Shack"]:Clone()
        Home.Parent = game.Workspace
        game.Workspace["Home-Shack"]:MoveTo(game.Workspace["Plot_"..PlotN.Value].Plot.Position)
        game.Workspace["Home-Shack"].Owner.Value = player.Name
        ----------------------------------------------
        --local H = player.HomeStats

    --if H.Part.Value == true then

        --game.Workspace["Home-Shack"].Upgrades.Part.CanCollide = true
        --game.Workspace["Home-Shack"].Upgrades.Part.Transparency = 0

    --elseif H.Porch.Value == true then

        --game.Workspace["Home-Shack"].Upgrades.Porch.CanCollide = true
        --game.Workspace["Home-Shack"].Upgrades.Porch.Transparency = 0      

    --end
    ----------------------------------------------------------------
        game.Workspace["Home-Shack"].Name = "Shack_"..player.Name
        --Rotation
        local function TransformModel(model, newCFrame)
        model:SetPrimaryPartCFrame(newCFrame)
        end 
        print(game.Workspace["Plot_"..PlotN.Value].Rotation.Rotation.Y)
        local model = game.Workspace["Shack_"..player.Name] 
        local rotatedCFrame = model:GetPrimaryPartCFrame() * CFrame.Angles(0, math.rad(game.Workspace["Plot_"..PlotN.Value].Rotation.Rotation.Y), 0)

        TransformModel(model, rotatedCFrame)
        --Rotation
        else
            choice.ResponseDialog = "You already have a home loaded on a plot."
            player.PlayerGui.NotifGui.FrameB.Notification.Text = "You already have a home loaded on a plot"
            wait(5)
            player.PlayerGui.NotifGui.FrameB.Notification.Text = ""
            choice.ResponseDialog = "Home Loaded."
        end
        end
    else
        choice.ResponseDialog = "You must buy a home in order to load your home."
        player.PlayerGui.NotifGui.FrameB.Notification.Text = "You must buy a home in order to load your home"
        wait(5)
        player.PlayerGui.NotifGui.FrameB.Notification.Text = ""
        player.PlayerGui.NotifGui.FrameB.Notification.Text = ""
    end
    end
    end

if choice.Name == "Surburban" then
    local HomeStats = player.HomeStats
    local PlotN = player.HomeStats.PlotN    

    if PlotN.Value == 0 then
    print(HomeStats.PlotN.Value)
        choice.ResponseDialog = "You must claim a plot before you can load your home"
        player.PlayerGui.NotifGui.FrameB.Notification.Text = "You must claim a plot before you can load your home"
        wait(5)
        player.PlayerGui.NotifGui.FrameB.Notification.Text = ""
        choice.ResponseDialog = "Home Loaded."  
    else
    if HomeStats.HasHome.Value == true then
    if HomeStats.HomeType1.Value == "Suburban" then
        if game.Workspace:FindFirstChild("Suburban_"..player.Name) == nil and game.Workspace:FindFirstChild("Shack_"..player.Name) == nil and game.Workspace:FindFirstChild("Modern_"..player.Name) == nil then
        local Home = game.Lighting["Home-Suburban"]:Clone()
        Home.Parent = game.Workspace
        game.Workspace["Home-Suburban"]:MoveTo(game.Workspace["Plot_"..PlotN.Value].Plot.Position)
        game.Workspace["Home-Suburban"].Owner.Value = player.Name
        ----------------------------------------------
        --local H = player.HomeStats

    --if H.Part.Value == true then

        --game.Workspace["Home-Shack"].Upgrades.Part.CanCollide = true
        --game.Workspace["Home-Shack"].Upgrades.Part.Transparency = 0

    --elseif H.Porch.Value == true then

        --game.Workspace["Home-Shack"].Upgrades.Porch.CanCollide = true
        --game.Workspace["Home-Shack"].Upgrades.Porch.Transparency = 0      

    --end
    ----------------------------------------------------------------
        game.Workspace["Home-Suburban"].Name = "Suburban_"..player.Name
        --Rotation
        local function TransformModel(model, newCFrame)
        model:SetPrimaryPartCFrame(newCFrame)
        end 
        print(game.Workspace["Plot_"..PlotN.Value].Rotation.Rotation.Y)
        local model = game.Workspace["Suburban_"..player.Name] 
        local rotatedCFrame = model:GetPrimaryPartCFrame() * CFrame.Angles(0, math.rad(game.Workspace["Plot_"..PlotN.Value].Rotation.Rotation.Y), 0)

        TransformModel(model, rotatedCFrame)
        --Rotation
        --game.Workspace["Plot_"..PlotN.Value].Grass.BrickColor = BrickColor.new("Camo")
        else
            choice.ResponseDialog = "You already have a home loaded on a plot."
            player.PlayerGui.NotifGui.FrameB.Notification.Text = "You already have a home loaded on a plot"
            wait(5)
            player.PlayerGui.NotifGui.FrameB.Notification.Text = ""
            choice.ResponseDialog = "Home Loaded."
        end
        end
    else
        choice.ResponseDialog = "You must buy a home in order to load your home."
        player.PlayerGui.NotifGui.FrameB.Notification.Text = "You must buy a home in order to load your home"
        wait(5)
        player.PlayerGui.NotifGui.FrameB.Notification.Text = ""
        choice.ResponseDialog = "Home Loaded."
    end
    end
    end

if choice.Name == "Modern" then
    local HomeStats = player.HomeStats
    local PlotN = player.HomeStats.PlotN    

    if PlotN.Value == 0 then
    print(HomeStats.PlotN.Value)
        choice.ResponseDialog = "You must claim a plot before you can load your home"
        player.PlayerGui.NotifGui.FrameB.Notification.Text = "You must claim a plot before you can load your home"
        wait(5)
        player.PlayerGui.NotifGui.FrameB.Notification.Text = ""
        choice.ResponseDialog = "Home Loaded."  
    else
    if HomeStats.HasHome.Value == true then
    if HomeStats.HomeType2.Value == "Modern" then
        if game.Workspace:FindFirstChild("Modern_"..player.Name) == nil and game.Workspace:FindFirstChild("Shack_"..player.Name) == nil and game.Workspace:FindFirstChild("Suburban_"..player.Name) == nil then
        local Home = game.Lighting["Home-Modern"]:Clone()
        Home.Parent = game.Workspace
        game.Workspace["Home-Modern"]:MoveTo(game.Workspace["Plot_"..PlotN.Value].Plot.Position)
        game.Workspace["Home-Modern"].Owner.Value = player.Name
        ----------------------------------------------
        --local H = player.HomeStats

    --if H.Part.Value == true then

        --game.Workspace["Home-Shack"].Upgrades.Part.CanCollide = true
        --game.Workspace["Home-Shack"].Upgrades.Part.Transparency = 0

    --elseif H.Porch.Value == true then

        --game.Workspace["Home-Shack"].Upgrades.Porch.CanCollide = true
        --game.Workspace["Home-Shack"].Upgrades.Porch.Transparency = 0      

    --end
    ----------------------------------------------------------------
        game.Workspace["Home-Modern"].Name = "Modern_"..player.Name
        --Rotation
        local function TransformModel(model, newCFrame)
        model:SetPrimaryPartCFrame(newCFrame)
        end 
        print(game.Workspace["Plot_"..PlotN.Value].Rotation.Rotation.Y)
        local model = game.Workspace["Modern_"..player.Name] 
        local rotatedCFrame = model:GetPrimaryPartCFrame() * CFrame.Angles(0, math.rad(game.Workspace["Plot_"..PlotN.Value].Rotation.Rotation.Y), 0)

        TransformModel(model, rotatedCFrame)
        --Rotation
        --game.Workspace["Plot_"..PlotN.Value].Grass.BrickColor = BrickColor.new("Camo")
        else
            choice.ResponseDialog = "You already have a home loaded on a plot."
            player.PlayerGui.NotifGui.FrameB.Notification.Text = "You already have a home loaded on a plot"
            wait(5)
            player.PlayerGui.NotifGui.FrameB.Notification.Text = ""
            choice.ResponseDialog = "Home Loaded."
        end
        end
    else
        choice.ResponseDialog = "You must buy a home in order to load your home."
        player.PlayerGui.NotifGui.FrameB.Notification.Text = "You must buy a home in order to load your home"
        wait(5)
        player.PlayerGui.NotifGui.FrameB.Notification.Text = ""
        choice.ResponseDialog = "Home Loaded."
    end
    end
    end

    if choice.Name == "UnPlot" then
    local PlotN = player.HomeStats.PlotN
        if PlotN.Value ~= 0 then
            local Parts = game.Workspace.PlotButtons:GetChildren()
            for i, v in pairs(Parts) do
                if v.Owner.Value == player.Name then
                    v.BrickColor = BrickColor.new("Parsley green")
                    v.ClickDetector.MaxActivationDistance = 32
                    v.Owner.Value = ""
                    if game.Workspace:FindFirstChild("Shack_"..player.Name) ~= nil then
                        game.Workspace["Shack_"..player.Name]:remove()
                        --game.Workspace["Plot_"..PlotN.Value].Grass.BrickColor = BrickColor.new("Brown")
                        PlotN.Value = 0
                    elseif game.Workspace:FindFirstChild("Suburban_"..player.Name) ~= nil then
                        game.Workspace["Suburban_"..player.Name]:remove()
                        --game.Workspace["Plot_"..PlotN.Value].Grass.BrickColor = BrickColor.new("Brown")
                        PlotN.Value = 0
                    elseif game.Workspace:FindFirstChild("Modern_"..player.Name) ~= nil then
                        game.Workspace["Modern_"..player.Name]:remove()
                        --game.Workspace["Plot_"..PlotN.Value].Grass.BrickColor = BrickColor.new("Brown")
                        PlotN.Value = 0
                    end
                end
            end
            PlotN.Value = 0
        else
            player.PlayerGui.NotifGui.FrameB.Notification.Text = "You must have a plot in order to switch it"
            wait(5)
            player.PlayerGui.NotifGui.FrameB.Notification.Text = ""
        end
    end
end)

Closed as Non-Descriptive by Link150 and M39a9am3R

This question has been closed because its title or content does not adequately describe the problem you are trying to solve.
Please ensure that your question pertains to your actual problem, rather than your attempted solution. That is, you were trying to solve problem X, and you thought solution Y would work, but instead of asking about X when you ran into trouble, you asked about Y.

Why was this question closed?