I have attached the code segment and the entire script so you have some perspective. I think I may be placing it incorrectly within the ends or something to that sort. Whenever you step on the spawn button the first time it does it(not good, will add a verification step to make sure it's active), but whenever you have a vehicle already it is supposed to pop up with the error but nothing happens. It doesn't spawn a vehicle, which means that part works. However, it will not show the gui or the error message. No output! Thank you for the help!
--
else if game.Players:FindFirstChild(hit.Parent.Name).PlayerValues.HasBoat.Value == true then
local gui = game.Players:FindFirstChild(hit.Parent.Name).PlayerGui.VehicleControl
gui.Frame.Visible = true
gui.Frame.ErrorField.Text = 'Error: You must destroy your old vehicle before spawning a new one.'
gui.Frame.ErrorField.Visible = true
gui.Frame.KillBoat.Visible = true
wait(10)
if gui.Frame.ErrorField.Visible == true then
gui.Frame.ErrorField.Visible = false
--
local box = script.Parent
local config = script.Parent.Configuration
local debounce = false
-- put the model in Replicated Storage
-- change "car" to the models name
-- and your done but dont group the model or button with anything
local everything = {model}
local names = {model}
local children = game.ReplicatedStorage:children()
for i=1,#children do
if (children[i].Name == config.VehicleName.Value) then -- hangar
table.insert(everything, children[i]:clone())
table.insert(names, children[i].Name)
end
end
function regen()
for i=1,#everything do
game.ReplicatedStorage:findFirstChild(names[i]):clone() -- Dont mess with this!
new_thing = everything[i]:clone()
new_thing.Parent = game.Workspace
new_thing:makeJoints()
end
end
function onTouched(hit)
local humanoid = hit.Parent:findFirstChild("Humanoid") -- OK were done!
if humanoid~=nil and debounce == false then
local playercash = game.Players:FindFirstChild(hit.Parent.Name).leaderstats.Cash
local playervalues = game.Players:FindFirstChild(hit.Parent.Name).PlayerValues
local VIPval = script.Parent.Configuration.GenericPass.Value
local VIPcash = script.Parent.Configuration.CostVIP.Value
local SpecificVal = script.Parent.Configuration.SpecificPass.Value
if game:GetService("BadgeService"):UserHasBadge(game.Players:FindFirstChild(hit.Parent.Name).UserId, SpecificVal) and playervalues.HasBoat.Value == false--[[Has specific VIP]]then
debounce = true
print('Has Specific VIP')
script.Parent.BrickColor = BrickColor.new(26)
script.Parent.Light.Color = Color3.new(0,0,0)
regen()
game.Workspace:FindFirstChild(config.VehicleName.Value).Name = game.Players:FindFirstChild(hit.Parent.Name).UserId
local boatname = Instance.new('StringValue')
boatname.Name = 'BoatName'
boatname.Value = game.Players:FindFirstChild(hit.Parent.Name).UserId
boatname.Parent = script.Parent
game.Workspace:FindFirstChild(script.Parent.BoatName.Value).Owner.Value = hit.Parent.Name
game.Workspace:FindFirstChild(script.Parent.BoatName.Value).DisplayOwner.Name = hit.Parent.Name
playervalues.HasBoat.Value = true
wait(10)
script.Parent.BoatName:Destroy()
wait()
script.Parent.BrickColor = BrickColor.new(1009)
script.Parent.Light.Color = Color3.new(255,255,0)
debounce = false
else
if game:GetService("BadgeService"):UserHasBadge(game.Players:FindFirstChild(hit.Parent.Name).UserId, VIPval) and playervalues.HasBoat.Value == false and playercash.Value >= config.CostVIP.Value --[[Has generic VIP]]then
debounce = true
print('Has Generic VIP')
script.Parent.BrickColor = BrickColor.new(26)
script.Parent.Light.Color = Color3.new(0,0,0)
regen()
game.Workspace:FindFirstChild(config.VehicleName.Value).Name = game.Players:FindFirstChild(hit.Parent.Name).UserId
local boatname = Instance.new('StringValue')
boatname.Name = 'BoatName'
boatname.Value = game.Players:FindFirstChild(hit.Parent.Name).UserId
boatname.Parent = script.Parent
game.Workspace:FindFirstChild(script.Parent.BoatName.Value).Owner.Value = hit.Parent.Name
game.Workspace:FindFirstChild(script.Parent.BoatName.Value).DisplayOwner.Name = hit.Parent.Name
playercash.Value = playercash.Value - config.CostVIP.Value
playervalues.HasBoat.Value = true
wait(10)
script.Parent.BoatName:Destroy()
wait()
script.Parent.BrickColor = BrickColor.new(1009)
script.Parent.Light.Color = Color3.new(255,255,0)
debounce = false
else if playercash.Value >= config.Cost.Value and playervalues.HasBoat.Value == false then --Regular non-VIP
print('Has Cash')
debounce = true
script.Parent.BrickColor = BrickColor.new(26)
script.Parent.Light.Color = Color3.new(0,0,0)
regen()
game.Workspace:FindFirstChild(config.VehicleName.Value).Name = game.Players:FindFirstChild(hit.Parent.Name).UserId
local boatname = Instance.new('StringValue')
boatname.Name = 'BoatName'
boatname.Value = game.Players:FindFirstChild(hit.Parent.Name).UserId
boatname.Parent = script.Parent
game.Workspace:FindFirstChild(script.Parent.BoatName.Value).Owner.Value = hit.Parent.Name
game.Workspace:FindFirstChild(script.Parent.BoatName.Value).DisplayOwner.Name = hit.Parent.Name
playercash.Value = playercash.Value - config.Cost.Value
playervalues.HasBoat.Value = true
wait(10)
script.Parent.BoatName:Destroy()
wait()
script.Parent.BrickColor = BrickColor.new(1009)
script.Parent.Light.Color = Color3.new(255,255,0)
debounce = false
else if playervalues.HasBoat.Value == false then
local plr = game.Players:FindFirstChild(hit.Parent.Name)
local link = game:GetService("MarketplaceService")
deb = 0
local marketId = script.Parent.Configuration.DevProduct.Value --ID OF YOUR DEVELOPER PRODUCT
link:PromptProductPurchase(plr,marketId)
link.ProcessReceipt = function(receiptInfo)
if Enum.ProductPurchaseDecision.PurchaseGranted and receiptInfo.PlayerId == plr.userId then
if deb == 0 then
deb = 1
print('DevProduct Used')
script.Parent.BrickColor = BrickColor.new(26)
script.Parent.Light.Color = Color3.new(0,0,0)
regen()
game.Workspace:FindFirstChild(config.VehicleName.Value).Name = game.Players:FindFirstChild(hit.Parent.Name).UserId
local boatname = Instance.new('StringValue')
boatname.Name = 'BoatName'
boatname.Value = game.Players:FindFirstChild(hit.Parent.Name).UserId
boatname.Parent = script.Parent
game.Workspace:FindFirstChild(script.Parent.BoatName.Value).Owner.Value = hit.Parent.Name
game.Workspace:FindFirstChild(script.Parent.BoatName.Value).DisplayOwner.Name = hit.Parent.Name
playervalues.HasBoat.Value = true
wait(10)
script.Parent.BoatName:Destroy()
wait()
script.Parent.BrickColor = BrickColor.new(1009)
script.Parent.Light.Color = Color3.new(255,255,0)
debounce = false
wait(1)
deb = 0
end
end
end
end
end
end
end
--
else if game.Players:FindFirstChild(hit.Parent.Name).PlayerValues.HasBoat.Value == true then
local gui = game.Players:FindFirstChild(hit.Parent.Name).PlayerGui.VehicleControl
gui.Frame.Visible = true
gui.Frame.ErrorField.Text = 'Error: You must destroy your old vehicle before spawning a new one.'
gui.Frame.ErrorField.Visible = true
gui.Frame.KillBoat.Visible = true
wait(10)
if gui.Frame.ErrorField.Visible == true then
gui.Frame.ErrorField.Visible = false
--
end
end
end
end
script.Parent.Touched:connect(onTouched)

4 comments
200+ lines :(
You should learn how to indent your code properly, it makes it much easier to see where you messed up in this kind of situation.
You can use elseif instead of typing else and if separately to reduce end count. For ex. if,elseif,elseif = Only one "End" required, but if,else,if,else,if = Three "End" is required.
Great to know. Unfortunately I need to get an update out that requires a quick fix instead of redoing that much of the code. My work week starts tomorrow and I have other things to accomplish.