For some reason this script is not working although there are no errors in any logs? [closed]
I checked for errors and I can't find any. Here is the script.
001 | script.Parent.Dialog.DialogChoiceSelected:connect( function (player,choice) |
004 | if choice.Name = = "Shack" then |
005 | local HomeStats = player.HomeStats |
006 | local PlotN = player.HomeStats.PlotN |
008 | if PlotN.Value = = 0 then |
009 | print (HomeStats.PlotN.Value) |
010 | choice.ResponseDialog = "You must claim a plot before you can load your home" |
011 | player.PlayerGui.NotifGui.FrameB.Notification.Text = "You must claim a plot before you can load your home" |
013 | player.PlayerGui.NotifGui.FrameB.Notification.Text = "" |
014 | choice.ResponseDialog = "Home Loaded." |
016 | if HomeStats.HasHome.Value = = true then |
017 | if HomeStats.HomeType.Value = = "Shack" then |
018 | 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 |
019 | local Home = game.Lighting [ "Home-Shack" ] :Clone() |
020 | Home.Parent = game.Workspace |
021 | game.Workspace [ "Home-Shack" ] :MoveTo(game.Workspace [ "Plot_" ..PlotN.Value ] .Plot.Position) |
022 | game.Workspace [ "Home-Shack" ] .Owner.Value = player.Name |
038 | game.Workspace [ "Home-Shack" ] .Name = "Shack_" ..player.Name |
040 | local function TransformModel(model, newCFrame) |
041 | model:SetPrimaryPartCFrame(newCFrame) |
043 | print (game.Workspace [ "Plot_" ..PlotN.Value ] .Rotation.Rotation.Y) |
044 | local model = game.Workspace [ "Shack_" ..player.Name ] |
045 | local rotatedCFrame = model:GetPrimaryPartCFrame() * CFrame.Angles( 0 , math.rad(game.Workspace [ "Plot_" ..PlotN.Value ] .Rotation.Rotation.Y), 0 ) |
047 | TransformModel(model, rotatedCFrame) |
050 | choice.ResponseDialog = "You already have a home loaded on a plot." |
051 | player.PlayerGui.NotifGui.FrameB.Notification.Text = "You already have a home loaded on a plot" |
053 | player.PlayerGui.NotifGui.FrameB.Notification.Text = "" |
054 | choice.ResponseDialog = "Home Loaded." |
058 | choice.ResponseDialog = "You must buy a home in order to load your home." |
059 | player.PlayerGui.NotifGui.FrameB.Notification.Text = "You must buy a home in order to load your home" |
061 | player.PlayerGui.NotifGui.FrameB.Notification.Text = "" |
062 | player.PlayerGui.NotifGui.FrameB.Notification.Text = "" |
067 | if choice.Name = = "Surburban" then |
068 | local HomeStats = player.HomeStats |
069 | local PlotN = player.HomeStats.PlotN |
071 | if PlotN.Value = = 0 then |
072 | print (HomeStats.PlotN.Value) |
073 | choice.ResponseDialog = "You must claim a plot before you can load your home" |
074 | player.PlayerGui.NotifGui.FrameB.Notification.Text = "You must claim a plot before you can load your home" |
076 | player.PlayerGui.NotifGui.FrameB.Notification.Text = "" |
077 | choice.ResponseDialog = "Home Loaded." |
079 | if HomeStats.HasHome.Value = = true then |
080 | if HomeStats.HomeType 1. Value = = "Suburban" then |
081 | 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 |
082 | local Home = game.Lighting [ "Home-Suburban" ] :Clone() |
083 | Home.Parent = game.Workspace |
084 | game.Workspace [ "Home-Suburban" ] :MoveTo(game.Workspace [ "Plot_" ..PlotN.Value ] .Plot.Position) |
085 | game.Workspace [ "Home-Suburban" ] .Owner.Value = player.Name |
101 | game.Workspace [ "Home-Suburban" ] .Name = "Suburban_" ..player.Name |
103 | local function TransformModel(model, newCFrame) |
104 | model:SetPrimaryPartCFrame(newCFrame) |
106 | print (game.Workspace [ "Plot_" ..PlotN.Value ] .Rotation.Rotation.Y) |
107 | local model = game.Workspace [ "Suburban_" ..player.Name ] |
108 | local rotatedCFrame = model:GetPrimaryPartCFrame() * CFrame.Angles( 0 , math.rad(game.Workspace [ "Plot_" ..PlotN.Value ] .Rotation.Rotation.Y), 0 ) |
110 | TransformModel(model, rotatedCFrame) |
114 | choice.ResponseDialog = "You already have a home loaded on a plot." |
115 | player.PlayerGui.NotifGui.FrameB.Notification.Text = "You already have a home loaded on a plot" |
117 | player.PlayerGui.NotifGui.FrameB.Notification.Text = "" |
118 | choice.ResponseDialog = "Home Loaded." |
122 | choice.ResponseDialog = "You must buy a home in order to load your home." |
123 | player.PlayerGui.NotifGui.FrameB.Notification.Text = "You must buy a home in order to load your home" |
125 | player.PlayerGui.NotifGui.FrameB.Notification.Text = "" |
126 | choice.ResponseDialog = "Home Loaded." |
131 | if choice.Name = = "Modern" then |
132 | local HomeStats = player.HomeStats |
133 | local PlotN = player.HomeStats.PlotN |
135 | if PlotN.Value = = 0 then |
136 | print (HomeStats.PlotN.Value) |
137 | choice.ResponseDialog = "You must claim a plot before you can load your home" |
138 | player.PlayerGui.NotifGui.FrameB.Notification.Text = "You must claim a plot before you can load your home" |
140 | player.PlayerGui.NotifGui.FrameB.Notification.Text = "" |
141 | choice.ResponseDialog = "Home Loaded." |
143 | if HomeStats.HasHome.Value = = true then |
144 | if HomeStats.HomeType 2. Value = = "Modern" then |
145 | 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 |
146 | local Home = game.Lighting [ "Home-Modern" ] :Clone() |
147 | Home.Parent = game.Workspace |
148 | game.Workspace [ "Home-Modern" ] :MoveTo(game.Workspace [ "Plot_" ..PlotN.Value ] .Plot.Position) |
149 | game.Workspace [ "Home-Modern" ] .Owner.Value = player.Name |
165 | game.Workspace [ "Home-Modern" ] .Name = "Modern_" ..player.Name |
167 | local function TransformModel(model, newCFrame) |
168 | model:SetPrimaryPartCFrame(newCFrame) |
170 | print (game.Workspace [ "Plot_" ..PlotN.Value ] .Rotation.Rotation.Y) |
171 | local model = game.Workspace [ "Modern_" ..player.Name ] |
172 | local rotatedCFrame = model:GetPrimaryPartCFrame() * CFrame.Angles( 0 , math.rad(game.Workspace [ "Plot_" ..PlotN.Value ] .Rotation.Rotation.Y), 0 ) |
174 | TransformModel(model, rotatedCFrame) |
178 | choice.ResponseDialog = "You already have a home loaded on a plot." |
179 | player.PlayerGui.NotifGui.FrameB.Notification.Text = "You already have a home loaded on a plot" |
181 | player.PlayerGui.NotifGui.FrameB.Notification.Text = "" |
182 | choice.ResponseDialog = "Home Loaded." |
186 | choice.ResponseDialog = "You must buy a home in order to load your home." |
187 | player.PlayerGui.NotifGui.FrameB.Notification.Text = "You must buy a home in order to load your home" |
189 | player.PlayerGui.NotifGui.FrameB.Notification.Text = "" |
190 | choice.ResponseDialog = "Home Loaded." |
195 | if choice.Name = = "UnPlot" then |
196 | local PlotN = player.HomeStats.PlotN |
197 | if PlotN.Value ~ = 0 then |
198 | local Parts = game.Workspace.PlotButtons:GetChildren() |
199 | for i, v in pairs (Parts) do |
200 | if v.Owner.Value = = player.Name then |
201 | v.BrickColor = BrickColor.new( "Parsley green" ) |
202 | v.ClickDetector.MaxActivationDistance = 32 |
204 | if game.Workspace:FindFirstChild( "Shack_" ..player.Name) ~ = nil then |
205 | game.Workspace [ "Shack_" ..player.Name ] :remove() |
208 | elseif game.Workspace:FindFirstChild( "Suburban_" ..player.Name) ~ = nil then |
209 | game.Workspace [ "Suburban_" ..player.Name ] :remove() |
212 | elseif game.Workspace:FindFirstChild( "Modern_" ..player.Name) ~ = nil then |
213 | game.Workspace [ "Modern_" ..player.Name ] :remove() |
221 | player.PlayerGui.NotifGui.FrameB.Notification.Text = "You must have a plot in order to switch it" |
223 | player.PlayerGui.NotifGui.FrameB.Notification.Text = "" |