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

tower defense simulator upgrade gui?

Asked by 1 year ago
Edited 1 year ago

whne you click at the tower it shows gui but if you click somewhere the gui stays and says this on output

attempt to index nil with 'Config'

here is the script pls help me fix this

local function CreateRangeCircle(tower, placeholder)

local range = tower.Config.Range.Value
local height = (tower.PrimaryPart.Size.Y / 1) + tower.Humanoid.HipHeight
local offset = CFrame.new(0, -height, 0)

local p = Instance.new("Part")
p.Name = "Range"
p.Shape = Enum.PartType.Cylinder
p.Material = Enum.Material.Neon
p.Transparency = 0.9
p.Size = Vector3.new(2, range * 2, range * 2)
p.TopSurface = Enum.SurfaceType.Smooth
p.BottomSurface = Enum.SurfaceType.Smooth
p.CFrame = tower.PrimaryPart.CFrame * offset * CFrame.Angles(0, 0, math.rad(90))        
p.CanCollide = false    

if placeholder then
    p.Anchored = false
    local weld = Instance.new("WeldConstraint")
    weld.Part0 = p
    weld.Part1 = tower.PrimaryPart
    weld.Parent = p
    p.Parent = tower
else
    p.Anchored = true
    p.Parent = workspace.Camera
end

end

Answer this question