Invisible head spawning underneath me everytime i walk, someone please help!

Hey guys! So I’m trying to work on a tycoon (using ZedNov’s tycoon set) and whenever i go near the tycoon, this happens:

I think that has something to do with the glitch I’m experiencing, which is the following:

A “invisible head” generates everytime I walk, and I don’t know why that happens!
This is the script: (Note that none of this was made by me, it’s all ZedNov’s tycoon kit script, completely unedited.

	--[[
		All configurations are located in the "Settings" Module script.
		Please don't edit this script unless you know what you're doing.
	--]]
	local Objects = {}
	local TeamColor = script.Parent.TeamColor.Value
	local Settings = require(script.Parent.Parent.Parent.Settings)
	local Money = script.Parent.CurrencyToCollect
	local Debris = game:GetService('Debris')
	local Stealing = Settings.StealSettings
	local CanSteal = true -- don't change or else you won't be able to steal currency
	
	script.Parent.Essentials.Spawn.TeamColor = TeamColor
	script.Parent.Essentials.Spawn.BrickColor = TeamColor
	
	function Sound(part,id)
		if part:FindFirstChild('Sound') then
			return
		else
			local Sound = Instance.new('Sound',part)
			Sound.SoundId = "rbxassetid://"..tostring(id)
			Sound:Play()
			delay(Sound.TimeLength, function()
				Sound:Destroy()
			end)
		end
	end
	
	--Parts that fall into the collector(s) get processed
	for i,v in pairs(script.Parent.Essentials:GetChildren()) do
		if v.Name == "PartCollector" then
			v.Touched:connect(function(Part)
				if Part:FindFirstChild('Cash') then
					Money.Value = Money.Value + Part.Cash.Value
					Debris:AddItem(Part,0.1)
				end
			end)
		end
	end
	
	--Player Touched Collector processor
	deb = false
	script.Parent.Essentials.Giver.Touched:connect(function(hit)
		local player = game.Players:GetPlayerFromCharacter(hit.Parent)
		if player ~= nil then
			if script.Parent.Owner.Value == player then
				if hit.Parent:FindFirstChild("Humanoid") then
					if hit.Parent.Humanoid.Health > 0 then
						if deb == false then
							deb = true
							script.Parent.Essentials.Giver.BrickColor = BrickColor.new("Bright red")
							local Stats = game.ServerStorage.PlayerMoney:FindFirstChild(player.Name)
							if Stats ~= nil then 
							Sound(script.Parent.Essentials, Settings.Sounds.Collect)
							Stats.Value = Stats.Value + Money.Value
							Money.Value = 0
							wait(1)
							script.Parent.Essentials.Giver.BrickColor = BrickColor.new("Sea green")
							deb = false
							end
						end
					end
				end
			elseif Stealing.Stealing then -- if player isn't owner and stealing is on
				if CanSteal == true then
					CanSteal = false
					delay(Stealing.PlayerProtection, function()
						CanSteal = true
					end)
					if hit.Parent:FindFirstChild("Humanoid") then
						if hit.Parent.Humanoid.Health > 0 then
							local Stats = game.ServerStorage.PlayerMoney:FindFirstChild(player.Name)
							if Stats ~= nil then
								local Difference = math.floor(Money.Value * Stealing.StealPrecent)
								Sound(script.Parent.Essentials, Settings.Sounds.Collect)
								Stats.Value = Stats.Value + Difference
								Money.Value = Money.Value - Difference
							end
						end
					end
				else
					Sound(script.Parent.Essentials, Settings.Sounds.Error)
				end
			end
		end
	end)
	
	script.Parent:WaitForChild("Buttons")
	for i,v in pairs(script.Parent.Buttons:GetChildren()) do
		spawn(function()
		if v:FindFirstChild("Head") then
			v.Head.CanCollide = false
				v.Head.Transparency = 1
			local ThingMade = script.Parent.Purchases:WaitForChild(v.Object.Value)
			if ThingMade ~= nil then
				Objects[ThingMade.Name] = ThingMade:Clone()
				ThingMade:Destroy()
			else
				--//Button doesn't have object, remove it
				error('Object missing for button: '..v.Name', button has been removed')
				v.Head.CanCollide = true
				v.Head.Transparency = 1
			end
									
			if v:FindFirstChild("Dependency") then --// if button needs something unlocked before it pops up
				v.Head.CanCollide = false
				v.Head.Transparency = 1
			    coroutine.resume(coroutine.create(function()
 					if script.Parent.PurchasedObjects:WaitForChild(v.Dependency.Value) then
						if Settings['ButtonsFadeIn'] then
							for i=1,20 do
								wait(Settings['FadeInTime']/20)
								v.Head.Transparency = v.Head.Transparency - 0.05
							end
						end
						v.Head.CanCollide = true
						v.Head.Transparency = 0
					end
				end))
			end
			
			v.Head.Touched:connect(function(hit)
				local player = game.Players:GetPlayerFromCharacter(hit.Parent)
				if v.Head.CanCollide == true then
					if player ~= nil then
						if script.Parent.Owner.Value == player then
							if hit.Parent:FindFirstChild("Humanoid") then
								if hit.Parent.Humanoid.Health > 0 then
									local PlayerStats = game.ServerStorage.PlayerMoney:FindFirstChild(player.Name)
									if PlayerStats ~= nil then
										if (v:FindFirstChild('Gamepass')) and (v.Gamepass.Value >= 1) then
											if game:GetService("MarketplaceService"):PlayerOwnsAsset(player,v.Gamepass.Value) then
												Purchase({[1] = v.Price.Value,[2] = v,[3] = PlayerStats})
											else
												game:GetService('MarketplaceService'):PromptPurchase(player,v.Gamepass.Value)
											end
										elseif (v:FindFirstChild('DevProduct')) and (v.DevProduct.Value >= 1) then
											game:GetService('MarketplaceService'):PromptProductPurchase(player,v.DevProduct.Value)
										elseif PlayerStats.Value >= v.Price.Value then
											Purchase({[1] = v.Price.Value,[2] = v,[3] = PlayerStats})
											Sound(v, Settings.Sounds.Purchase)
										else
											Sound(v, Settings.Sounds.ErrorBuy)
										end
									end
								end
							end
						end
					end
				end
			end)
			end
		end)
	end
	
	function Purchase(tbl)
		local cost = tbl[1]
		local item = tbl[2]
		local stats = tbl[3]
		stats.Value = stats.Value - cost
		Objects[item.Object.Value].Parent = script.Parent.PurchasedObjects
		if Settings['ButtonsFadeOut'] then
			item.Head.CanCollide = false
			coroutine.resume(coroutine.create(function()
				for i=1,20 do
					wait(Settings['FadeOutTime']/20)
					item.Head.Transparency = item.Head.Transparency + 0.05
				end
			end))
		else
			item.Head.CanCollide = false
			item.Head.Transparency = 1
		end
	end
	
	function Create(tab)
		local x = Instance.new('Model')
		Instance.new('NumberValue',x).Value = tab[1]
		x.Value.Name = "Cost"
		Instance.new('ObjectValue',x).Value = tab[2]
		x.Value.Name = "Button"
		local Obj = Instance.new('ObjectValue',x)
		Obj.Name = "Stats"
		Obj.Value = tab[3]
		x.Parent = script.Parent.BuyObject
	end
	
	--// This was very rushed and is inefficent; if you plan on making something like this don't use a child added listener.
	script.Parent:WaitForChild('BuyObject').ChildAdded:connect(function(child)
		local tab = {}
		tab[1] = child.Cost.Value
		tab[2] = child.Button.Value
		tab[3] = child.Stats.Value
		Purchase(tab)
		wait(10)
		child:Destroy()
	end)

The problem happens at line 109, and I don’t know why!
This is everything that is around line 109


If you could help me, I would much appreciate it!

Whenever I change it to warn, the buttons aren’t shown at all and the invisible head glitch still happens, even though “v.Head.CanCollide” is set to false.

And just for reference, the line that fails according to Output is:

if script.Parent.PurchasedObjects:WaitForChild(v.Dependency.Value) then

Can we get a link to the original tycoon kit? Just tryna get things in to perspective.

I’m not a professional scripter, but I know that sometimes errors in a script can be vague and doesnt show in the output. I’m pretty sure this is a really old script and it might be outdated. Maybe thats the problem. All I see is that line with the red underline about the colision being true. Maybe if you change it to false then the head will still be there, but it wont push your character up. Also I see ontop of that script the guy that wrote it put a note saying that if the button doesnt have an object then remove it. I guess you could just remove that entire part from else to transparency = 1. Again im not a pro so im not sure.

1 Like

Sure thing! There you go: https://www.roblox.com/library/316073214/Zeds-Tycoon-Kit-FIXED

When turning it to false, the head actually shouldn’t be pushing your character up, but it still does! And the red error outline still stays there. I actually have no idea why. But I will eventually try that if no other solutions resolve my problem. Thanks!

This is a video on how to use the kit. Maybe this will help. Im not sure maybe you already watched it.

Well, when I spawned the model in and tested the template it gave me, everything was perfectly normal…

Another thing I noticed is that these ‘heads’ that the script mentions refers to the tycoon purchase buttons, which are called “Head”, so there is no way that these collisions being on or off would affect your character in that fashion.

I also got the same warnings in my output for possible infinite yields, but I did not have any issues with an invisible brick spawning under my character, so those are not the issue.

Regarding the block of code you sent that has a red underline under “v.Head.CanCollided = true”, that underline is there because the statement ‘error()’ is one line above it. Here’s what it should look like:

Either way, this wouldn’t be the fix to your problem. Here’s what you should do:

  1. Test the game in studio, but this time when your character starts floating, check the explorer and see what type of brick is being spawned in and where. Get the name of it and use ‘ctrl+f’ in the scripts to search for the brick’s name.
  2. If no brick is being spawned, then it might have to do with your character humanoid’s ‘HipHeight’ property, which is being changed by an unrelated script or an edit you made.
  3. If you can’t succeed with these steps, try re-adding the template to your game and testing it once more. If it doesn’t work even after respawning it, then that’s confirmation that there’s another script colluding with your avatar.
1 Like

Hey! I actually have to apologize, the issue had nothing to do with the tycoon itself, I actually placed a zombie model outside of the tycoon, so I could use it as character size reference, and well, that was the thing that was causing the issue, I sincerely apologize for the misconceptions. Answer will still be marked as Solution, though.