Hello! So I am creating. tower defense game, however,
How do I fix this collision issue. The zombie have CanCollide set to false.
Thanks, WE
Hello! So I am creating. tower defense game, however,
How do I fix this collision issue. The zombie have CanCollide set to false.
Thanks, WE
Is CanTouch
set to false also?
Tried turning it off. It does the same thing.
Set the part(s) for the exit to false for CanCollide
and CanTouch
But then the players can also go through. How would I make it so the players can’t go through?
you can fix this by putting a invisible part above where the zombies go but lower then the player so they can not go through.
Or you know what, I completely forgot about LocalScripts lol.
I would set CanCollide to true on the Client.
Use PhysicsService
You create a group for minions & exits, then set the group collision to false.
Ok, I dont know if you can use them because I know any lua.
Example code:
local PhysicsService = game:GetService("PhysicsService")
local MinionsAndExitGroup = PhysicsService:CreateCollisionGroup("Minions&Exits")
-- Make them uncancollideable
PhysicsService:CollisionGroupSetCollidable("Minions&Exits", "Minions&Exits", false)
.OnMinionCreation:Connect(function(minion)
-- Assuming minion is a character model
for _, basepart in ipairs(minion:GetChildren()) do
-- If not part is a basepart then continue
if not basepart:IsA("BasePart") then continue end
MinionsAndExitGroup:SetPartCollisionGroup(basepart, "Minions&Exits")
end
end)
-- Upon the minion being killed, the character model would be destroyed
-- So the parts from the minions would be removed automatically, I guess, check it yourself to make sure
I’m making this code based on the assumption that you have an event when a minion is created, I have no idea what your code is so this is the best I can do
My bad, the line
MinionsAndExitGroup:SetPartCollisionGroup(basepart, "Minions&Exits")
should have been
PhysicsService:SetPartCollisionGroup(basepart, "Minions&Exits")
Yea sorry. I have never used PhysicsService before, Collision groups, and I am horrible with Raycasts.
No errors, and it still seems to be doing it.
local PhysicsService = game:GetService("PhysicsService")
local ZombieAndExitGroup = PhysicsService:CreateCollisionGroup("ZombiesAndExit")
local Copied = {}
for i, v in pairs(script:GetChildren()) do
table.insert(Copied, v.Name)
end
for UnitsNumber, UnitsObject in pairs(game.ReplicatedStorage.Enemys:GetChildren()) do
for CopiedNumber, CopiedObject in pairs(Copied) do
PhysicsService:CollisionGroupSetCollidable("ZombiesAndExit", "ZombiesAndExit", false)
for _, Parts in pairs(UnitsObject:GetDescendants()) do
if Parts:IsA("BasePart") then
PhysicsService:SetPartCollisionGroup(Parts, "ZombiesAndExit")
end
end
What does the table Copied
contain?
The loop layout is also weird.
Why are you iterating the zombies in ReplicatedStorage
? Isn’t it supposed to be the clone one?
And why is there a follow up iteration of Copied
?
I’m assuming that you want to compare the parts between these?
Also put the line
PhysicsService:CollisionGroupSetCollidable("ZombiesAndExit", "ZombiesAndExit", false)
under
PhysicsService:CreateCollisionGroup("ZombiesAndExit")
since it only needs to be initialized once
(Remove local ZombieAndExitGroup
since that returns void my bad.)
And by checking if Parts is a basepart you’re just making the ones in ReplicatedStorage
Uncancollide, which does nothing since it’s not a clone
Have you tried SurfaceGui
What would SurfaceGui’s have to do with collisions? I might be wrong whey saying that, since I was wrong when I was a beginner scripter when I said that TweenService can’t make a stopwatch.
SurfaceGui
is more resistant to collisions. It is not preferred most of the time. But I’m sure it will solve the collision problem.
Um no. I am not using SurfaceGui’s to make zombies…
Can you share a screenshot of the BillboardGui settings?