You can write your topic however you want, but you need to answer these questions:
- What do you want to achieve? Keep it simple and clear!
Well, i am making a tower defense game and i put the enemies and the player in a different collision groups using a script. But while i cant collide with the enemies i can push them for some reason.
- What is the issue? Include screenshots / videos if possible!
as you can see in the video listed above i can push them, and sometimes they also just decide to disappear.
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
script with the player collision group
(server script)
local Players = game:GetService('Players')
Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
for i, object in ipairs(character:GetDescendants()) do
if object:IsA("Part") then
object.CollisionGroup = "Player"
end
end
end)
end)
here is my mob module script
local ServerStorage = game:GetService('ServerStorage')
local EasyModeFolder = ServerStorage.Mobs:WaitForChild('EasyMode')
local mob = {}
function mob.Move(mob, map)
local humanoid = mob:WaitForChild('Humanoid')
local waypoints = map.Waypoints
for waypoint=1, #waypoints:GetChildren() do
humanoid:MoveTo(waypoints[waypoint].Position)
humanoid.MoveToFinished:Wait()
end
mob:Destroy()
end
function mob.Spawn(name, quantity, map)
local mobExists = ServerStorage.Mobs:FindFirstChild(name)
if mobExists then
for i=1, quantity do
task.wait(0.5)
local newMob = mobExists:Clone()
newMob.HumanoidRootPart.CFrame = map.Start.CFrame
newMob.Parent = map.Mob
newMob.HumanoidRootPart:SetNetworkOwner(nil)
for i, object in ipairs(newMob:GetDescendants()) do
if object:IsA("Part") then
object.CollisionGroup = "Mob"
end
end
coroutine.wrap(mob.Move)(newMob, map)
end
else
warn('Requested mob, "' .. name .. '" does not exist')
end
end
return mob
line 29 through 33 is where i set the collision groups for the enemies.
And yes, i am following the gnomecode tutorials as i have no idea how to make a tower defense game.
Help would be appreciated.