It slightly freezes my screen when this runs and then shows it printed (x546). I just want that specific player to be able to walk through when this runs but it breaks and lets anyone through.
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
end
end
end
end
end
end)
Have you tried adding a delay, using break or continue?
for i,Circle in workspace:GetChildren do
if Circle.Name == "FireCircle" then
for j,v1 in Circle.FireCircle:GetChildren do
for n,v2 in Circle.Walls:GetChildren() do
if Circle.Owner.Value == player.Name then
print("hi "..player)
continue -- maybe add a Continue?
end
end
end
end
end
That doesn’t stop it from being spammed. I’m pretty sure either with a BindableEvent/Function or a RemoteFunction (if I remember correctly) you get an error for spamming
That shouldn’t be the issue, its going through every single item within a table, it does not repeat if have it fire for a certain item, but in this case @itzF_nny is just getting a object within that table (Assuming its just one), shouldnt repeat
for number,index in pairs(Example:GetChildren()) do
print(number, index) -- prints every single item
if index.Name == "Item" then
print(index) -- should only print the specified item rather than all
end
What do you want your code to do?
What do you want a specific player to be able to walk through?
And what does your workspace look like? (specifically the "FireCircle"s)
The spell you cast clones a model into workspace that traps a character. I want you (The caster) to be able to freely walk through the model while everyone else including the victim (Trapped person) can not.
When is the OnClientEvent you sent fired?
If it’s every time when a firecircle is created then you could just fire the event with the created firecircle. Then you only need one loop and no checks to see if they’re the owner.