#need help with scripting @bollaside
234 messages · Page 1 of 1 (latest)
alright you gotta post the script tho cuz I do not remember it by heart (surprising, ik)
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
coroutine.wrap(mob.Move)(newMob, map)
end
else
warn("Requested mob does not exist:", name)
end
end
return mob```
here
the mobs are spawning in just fune
fine(
fine*
I dont want them to collide with each other
thats it
Ok so what you wanna do is make a CollisionGroup, make it so that mob group does not collide with mob group (itself) and set their parts to it
you'll need to make a variable for the PhysicsService
at the top
@opal pewter
so
to recap it, I gotta first go to model and get on the Collision groups?
and from there
oh
so make a PhysicsService variable (it's just like ServerStorage but with PhysicsService instead)
tell me when done
yep
now under mob variable, you'll want to use PhysicsService:CreateCollisionGroup(name) to create a collision group
replace name with the group name in quotes
ok
it can be anything
but I'd recommend with something you'll later understand like "Mob"
could u help me locate where to place it? as I mentioned before I have no damm idea about scripting
below local mob...
and below that you're gonna want to put PhysicsService:CollisionGroupSetCollidable(name, name, false)
where you'll replace name with your group anem
no wait
in parentheses is supposed to be the group name in quotes
by just putting mob you're referencing to the variable above, that's not what you want
it's supposed to be something like "Mob"
OHH
bro you're actually cool
I am actually understanding things
for the first time
Nice
yes
now?
now this but you replace name with the same group name as you did when you used CreateCollisionGroup
don't forget the quotes
and capital letters matter
PhysicsService:CollisionGroupSetCollidable(name, name, false)
oh and leave false as is
yes, they're all the same
one will be Mob as per of the createdCollision group
what am I supposed to write then? Mob in both
?
same in all 3 places
nope, you forgot the quotes
yes
oh
just like that
not yet
I was scared
@coarse spruce
we only created the group and set if 2 parts have the same group they don't collide
yeah ik that from the script
ok
so now we're gonna modify the mob.Spawn function
we're gonna write a loop to make every part of the mob the group we need, below line 27 make a new line
because when I do this, the mob doesnt spawn or they fall down when they are being spawned
so I think now this will be resolved
I guess
below line 27 I'll make a new line
yes
below it
ok
now you're gonna want to type this cryptic line: for _, obj in newMob:GetDescendants() do and press enter
so what this does is it loops through every instance inside of the mob model
and what it does with each obj is should be at line 29
?
yeah
if you did it right there should be a blank line and end to lines below
now press enter
did
it should look something like this
for ....
(your cursor here)
end
alright
now here you're gonna want to check if the instance is an actual part that we can assign the group to
because if it's an image for example we can't do that
ofc
and to check it you type if obj:IsA("BasePart") then and press enter
now there, the last line (not at the last line of the script fyi), you assign the collision group
using obj.CollisionGroup = name
where once again, name is the group name
i give this obj.CollisionGroup = name on line 30?
ok
now show what the script looks like
just mob?
same you did on lines 4 and 5
you forgor the quotes again
I give run?
yeah
Gg
Bolaside, is there anyway I could vouch you for helping me out?
I want you to get promoted ASAP
Nah xd
okay so If I run into
** You are now Level 6! **
yeah sure
No problem haha
could I get you added? I've become a fan of you now
you've explained it splendidly
thank you so much again
Mark this as solved btw so people don't think it's unsolved
No problem have a good one xd
alright, if I run into any sort of problems I'll make a thread and ping you
okay thanks
have a great day!
@coarse spruce so sorry to disturb you but how'd I turn of player collisions off because it works but I am still colliding with my own mobs
wdym?
I am colliding with the mobs
for some reason..
but the mobs arent colliding with each other
okay nevermind
I'll work on this on my own
sorry
Okay
@coarse spruce alright so uh, I've tried this and this will def not work I think, I want the players not to collide with the mobs now
which line
also add player.CharacterAppearanceLoaded:Wait() below line 6
8
swap line 6 and line 7
no
swap them
make line 6 be line 7 and line 7 be line 6
just select line 6
OHH
and press alt + ↓
should be done