If statement bypass

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Nuking

  2. What is the issue? So i have lots of if check,And the problem is,It error out that Size is not a valid member of 10,Which is a script,But I’ve added if for if it is a basepart,If it is unanchored which should error out here too and if its position is too far which it should also error out here,But it doesn’t,It only error when the code reach when I’d get the size of the part to compute particle,And my script error at 670.9333333333334 as radius which youll have to look in my code

  3. What solutions have you tried so far? Increasing the loop count,By increasing max effect range It seemed that the culprit is the destruction function it self

DESTRUCTION FUNCTION
function Destruction(Pos,Radius)
	local function Destroy(Model)
		if Model.Name == "Nuke" then return end
		for i ,v in ipairs(Model:getChildren()) do
			if v:isA("BasePart") and not v:FindFirstAncestor("Nuke")   then
				if (v.Position-Pos).magnitude < Radius*4 then
					if v.Anchored == false then
						if game.Players:GetPlayerFromCharacter(v.Parent) then
							local dead = game.Players:GetPlayerFromCharacter(v.Parent).codestats["Dead?"]
							dead.Value = true
							local plr = game.Players:GetPlayerFromCharacter(script.Parent.Parent)
							game.ReplicatedStorage.Shake:FireClient(plr,1000,3)
							game.ReplicatedStorage.Sound:FireClient(plr)
						else
							local smoke = game.ServerStorage.ParticleEmitter:Clone()
							smoke.Parent = script.Parent
							--smoke.Enabled = false
							local size = {
								NumberSequenceKeypoint.new(0,(script.Parent.Size.X +script.Parent.Size.Y +script.Parent.Size.Z )/20);
								NumberSequenceKeypoint.new(1,(script.Parent.Size.X +script.Parent.Size.Y +script.Parent.Size.Z )/20);
							}
							smoke.Size = NumberSequence.new(size)
							smoke.Rate = (script.Parent.Size.X +script.Parent.Size.Y +script.Parent.Size.Z )*4
							game.Debris:AddItem(smoke,20)
						end

						v:BreakJoints()
						v.Velocity = CFrame.new(v.Position,Pos):VectorToWorldSpace(Vector3.new(math.random(-5,5),5,400))
						v.Material = "CorrodedMetal"
						deb:AddItem(v,10)
						v.Anchored = false

					end	
				end
			end
			if #v:getChildren() > 0 then
				Destroy(v)
			end
		end
	end
	Destroy(game.Workspace)
end
local function detonate()
	for radiusc = 0, size/speedofsound,1/60 do
		--Destruction(script.Parent.Parent.Center.Position,radiusc*speedofsound*3.7)
		print(radiusc*speedofsound*3.7)
		game["Run Service"].Heartbeat:Wait()
	end
	connecttion:Disconnect()
end

Any my script that should work did not

2 Likes

Which line is the error? [limit]

1 Like
						NumberSequenceKeypoint.new(1,(script.Parent.Size.X +script.Parent.Size.Y +script.Parent.Size.Z )/20);

even stranger Destroy(game.Workspace.Util) should only destroy stuff inside util but it still error which is impossible since 10 the script is outside of util and IM SURE that i havent acidentally put some workspace in there since i already search for it and only found it as a reference to util

1 Like

Try print what the parent’s name and path is before you do that line of code and see exactly what part it is trying to get the size of and see if it is actually a descendant of Nuke

1 Like

10,The script inside of nuke inside of worksapce,BUt i only destroy in the Util

1 Like

where is the script? can you show an image

1 Like

I cannot (deleted my desktop lol)
but
workspace
Nuke
10
Destroyer(The script)

That part of code is used to v:Getchildren to get model or part in model in Util,It is getdecendant but kind of more efficient(My testing) and this script,Was modified from another nuke script which WORK

1 Like

how about you check if v isnt a descendant of Nuke already anyway otherwise you’re just runnign the function for no reason, also what is ‘10’?

1 Like

what is 10, and what is that line meant to do?
becayse if the scripts parent is always 10 and 10 is always a script then i dont see why it would have a size ever.

1 Like

10 is a script which I malfunctional named and os used for tweening the nuclear effect and the problem is,Its looping over it causing it to error,But…Ive already added a Basepart check and even a Ancestor check and theres a time that it’d still be looped over,When i Even stop ‘Destroying’ the workspace and destroy All decendant inside Util which is inside Workspace,It’d still loop through the 10

1 Like
						NumberSequenceKeypoint.new(1,(script.Parent.Size.X +script.Parent.Size.Y +script.Parent.Size.Z )/20);

if this is the line with the error, this line will ALWAYS check 10 for its size when this bit is ran

mabye you meant to put v.Size?

1 Like

HUH OMG thankyou [chars chars]

2 Likes