Hello im making a hotdog stand for a script builder and it happens that every 2 or 3 seconds i can go through the walls and everything, there are no errors, i tried using .Changed but the can collide property doesn't change even if i can go through the walls, what am i doing wrong?

local owner = game:GetService("Players")["maumaumaumaumaumau"]
owner.Character.Torso.CFrame = CFrame.new(Stand.MainStand.VehicleSeat.Position)
script.Parent = owner.Character

function FullAnchor()
		for i,v in pairs(Stand:GetDescendants()) do  if v.ClassName ~= "Script" and v.ClassName ~= "Model" and v.ClassName ~= "Weld" and v.ClassName ~= "SpecialMesh" and v.ClassName ~= "Sound"  and v.ClassName ~= "DistortionSoundEffect" then 
		v.Anchored = true 
	end
		end
		end
function FullHide()
		for i,v in pairs(Stand.big:GetDescendants()) do  if v.ClassName ~= "Script" and v.ClassName ~= "Model" and v.ClassName ~= "Weld" and v.ClassName ~= "SpecialMesh" and v.ClassName ~= "Sound"  and v.ClassName ~= "DistortionSoundEffect" then 
		v.Transparency = 1
	
		v.CanCollide = false
		if v:IsA("VehicleSeat") or v:IsA("Seat") then
			v.Disabled = true
		end
	
	end
		end
		end
function ToggleBig()
	for i,v in pairs(Stand.big:GetDescendants()) do  if v.ClassName ~= "Script" and v.ClassName ~= "Model" and v.ClassName ~= "Weld" and v.ClassName ~= "SpecialMesh" and v.ClassName ~= "Sound"  and v.ClassName ~= "DistortionSoundEffect" then 
		if v.Transparency == 0 then
		v.Transparency = 1 
		elseif v.Transparency == 1 then
			v.Transparency = 0
		end
		if v.Name == "glass" then
			v.Transparency = 0.5
		end
		v.CanCollide = not v.CanCollide 
		if v:IsA("VehicleSeat") or v:IsA("Seat") then
			v.Disabled = not v.Disabled
		end 
	end
	end
	end
FullHide()
FullAnchor()
function Clone(Child,parent)
	if not parent then
	return Child:Clone()
	else
		local ClonedChild = Child:Clone()
		ClonedChild.Parent = parent
		return ClonedChild
	end
end

owner.Chatted:Connect(function(m)
	if m:lower() == ("toggle/") then
		ToggleBig()
	end
end)

1 comment

0

i called FullHide() and FullAnchor() to hide and anchor the big part of the model