I making TD game
At first, there was no such error, but apparently, after updating the studio or new scripts, it appeared, tried to rewrite, etc. but it does not want to disappear, please help
2. It appears after the spawning tower, config (configuration object) in tower file,Range is intValue
Screenshot:
I have now tried to replace the tower with towers (local towers = ReplicatedStorage:Wait For Child(“Towers”) Towers-folder with tower models) but the error remained
before is mouse raycast function
after is create of CreateRangeCircle
local function RemovePlaceholderTower()
if towerToSpawn then
towerToSpawn:Destroy()
towerToSpawn = nil
rotation = 0
end
end
local function AddPlaceholderTower(name)
local towerExists = towers:FindFirstChild(name)
if towerExists then
RemovePlaceholderTower()
towerToSpawn = towerExists:Clone()
towerToSpawn.Parent = workspace.Towers
CreateRangeCircle(towerToSpawn, true)
for i, object in ipairs(towerToSpawn:GetDescendants()) do
if object:IsA("BasePart") then
PhysicsService:SetPartCollisionGroup(object, "Tower")
if object.Name ~= "Range" then
object.Material = Enum.Material.ForceField
object.Transparency = 0.3
end
end
end
end
end
local function ColorPlaceholderTower(color)
for i, object in ipairs(towerToSpawn:GetDescendants()) do
if object:IsA("BasePart") then
object.Color = color
end
end
end
I’m bad at scripting, most of it was written using tutorials
If this come appeared so the script is not the problem.
Try this on top of local range = tower.Config.Range.Value
And make a screenshot
I guess is come from the Explorer
local function CreateRangeCircle(tower, placeholder)
print(tower,typeof(tower))
print(tower,typeof(Config))
print(tower,typeof(Config.Range))
print(tower,typeof(Config.Range.Value))
my bad i have write errors can you test this and replace with other thing:
I put Config instead tower.Config
local function CreateRangeCircle(tower, placeholder)
print(tower,typeof(tower))
print(tower,typeof(tower.Config))
print(tower,typeof(tower.Config.Range))
print(tower,typeof(tower.Config.Range.Value))
The issue is that the parameter tower is a number, not an object.
Basically look where you called this from and fix the parameter you send through, because the parameter type is incorrect, it has to be an object not a number.