Yes, it’s every time its created. So would I just put the event in the model?
No I meant this:
event:FireClient( playerThatCreatedTheCircle, theFireCircleThatWasCreated )
Then you can just do
WitchEvents.FireCircleLocal.OnClientEvent:Connect(function(Circle)
print(player)
for i,v1 in pairs(Circle.FireCircle:GetChildren()) do
v1.CanCollide = false
end
for i,v2 in pairs(Circle.Walls:GetChildren()) do
v2.CanCollide = false
end
end)
so you don’t have to loop through every fire circle to update every fire circle made by you. Since with this you only update the fire circle that needs to be updated.
Yes, this is also what it looks like in my workspace. (Except the folders as models)
But more parts makes your game lag. Instead of adding how many times it prints, it multiplies it.
So 6x6 = 36. And your folder has way more than 6, resulting in game lag.
Not sure if this is correct, so correct me if I’m wrong.
your looping through workspace every client event, and if you want something to not collide with your players, might I suggest collision groups?
(put every player in their own collision group, put the players and the parts in the collision group and then disable collision for playercollisiongroup-playercollisiongroup)
I think these two loops need to not be inside of each other. I can’t figure out why they are inside of each other, and I can’t see any way that it wouldn’t cause an issue. Separate the loops like this and let me know what it does.
WitchEvents.FireCircleLocal.OnClientEvent:Connect(function()
for i,Circle in pairs(game.Workspace:GetChildren()) do
if Circle.Name == "FireCircle" and Circle.Owner.Value == player.Name then
print(player)
for i,v1 in pairs(Circle.FireCircle:GetChildren()) do
v1.CanCollide = false
end
for i,v2 in pairs(Circle.Walls:GetChildren()) do
v2.CanCollide = false
end
end
end
end)
To avoid freezing, you can try to use wait()
EX:
WitchEvents.FireCircleLocal.OnClientEvent:Connect(function()
for i,Circle in pairs(game.Workspace:GetChildren()) do
if Circle.Name == "FireCircle" then
for i,v1 in pairs(Circle.FireCircle:GetChildren()) do
for i,v2 in pairs(Circle.Walls:GetChildren()) do
if Circle.Owner.Value == player.Name then
print(player)
v1.CanCollide = false
v2.CanCollide = false
wait()
end
end
end
end
end
end)
By doing this, it gets every part in Walls and FireCircle but waiting by 1 millisecond each time.
Scratch what I said this works perfectly. Thank you!
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.