-
What do you want to achieve? Keep it simple and clear!
The tower’s RangeBox not to be malfunctioning, and have no collisions to other objects.
This is a demonstration of a Non-Humanoid:
robloxapp-20220221-1120096.wmv (3.5 MB)
-
What is the issue? Include screenshots / videos if possible!
Some sort of collision error or weld, I don’t know. It get’s pushed away from any object.
robloxapp-20220221-1121370.wmv (3.1 MB)
It also doesn’t move the RangeBox when placed, either:
(Ignore the zombies) -
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
--There is a bunch of code above it. This simply handles collisions etc
RunService.RenderStepped:Connect(function()
if TowerToSpawn then
local result = MouseRaycast({TowerToSpawn})
if result and result.Instance then
local GetRangeBoxTouchingParts = TowerToSpawn.RangeBox:GetTouchingParts()
if result.Instance.Parent.Name == "TowerArea" then
CanPlace = true
ColorPlaceholderTower(Color3.new(0,1,0))
else
CanPlace = false
ColorPlaceholderTower(Color3.new(1,0,0))
end
for index, part in ipairs(GetRangeBoxTouchingParts) do
if part.Name == "RangeBox" and part.Parent ~= TowerToSpawn then
CanPlace = false
ColorPlaceholderTower(Color3.new(1,0,0))
end
end
local x = result.Position.X
local y
if TowerToSpawn.Humanoid.RigType == Enum.RigType.R15 then
y = result.Position.Y + TowerToSpawn.Humanoid.HipHeight + (TowerToSpawn.PrimaryPart.Size.Y / 2)
else
y = TowerToSpawn:GetExtentsSize().Y / 2
end
local z = result.Position.Z
local cframe = CFrame.new(x,y,z) * CFrame.Angles(0, math.rad(Rotation), 0)
TowerToSpawn:SetPrimaryPartCFrame(cframe)
PhysicsService:SetPartCollisionGroup(TowerToSpawn.Range,"Tower")
PhysicsService:SetPartCollisionGroup(TowerToSpawn.RangeBox,"TowerBox")
TowerToSpawn.Range.Size = Vector3.new(0.1, TowerToSpawn.Levels[TowerToSpawn.CurrentLevel.Value].Range.Value * 2, TowerToSpawn.Levels[TowerToSpawn.CurrentLevel.Value].Range.Value * 2)
end
end
end)