Hey. I have a problem with my code. I don't know how to check if the player has 1 rebirth. I mean If player rebirth >= 1 then ...

I want to use it in the teleporter script like if player... then teleport.

Teleport script:


local Teleport_To_This_Tag = "0004" 	-- This is the Tag thing you find in the teleporter bricks. The brick with the tag that matches this is the brick you will tele to once you touch this one.

function findTele(tag) 
	local tele = nil 
	function scan(p) 
		for _,v in pairs(p:GetChildren()) do 
			if ((v.Name == "Telepad") and (v:findFirstChild("Tag"))) then 
				if (v.Tag.Value == tag) then tele = v break end 
			end 
			if (#v:GetChildren() > 0) then scan(v) end 
		end 
	end 
	scan(game:service("Workspace")) 
	return tele 
end 

--I want Rebirth check here

script.Parent.Touched:connect(function(h) 
	local p = game:service("Players"):GetPlayerFromCharacter(h.Parent) 
	if not (p) then return end 
	if (p:findFirstChild("JustTeleported")) then return end 
	if not (findTele(Teleport_To_This_Tag)) then return end 
	local tele = findTele(Teleport_To_This_Tag) 
	if (tele) then 
		if (p.Character) then 
			p.Character:MoveTo(tele.CFrame.p+Vector3.new(0,3.25,0)) 
			local t = Instance.new("Weld") 
			t.Name = "JustTeleported" 
			t.Parent = p 
			delay(1.5,function() t:remove() end) 
		end 
	end 
end) 

I am using zed's tycoon kit and save tycoon thing from toolbox. this save thing added rebirths and I don't know where's the code that adds it but I add this save thing link here -

https://web.roblox.com/library/4865917965/

how can I put a rebirth count check in this? Please be as simple as you can.

2 comments

0

Send the leaderstats code so I can understand how your rebirth is structure. Secondly, please add a comment in your above code to tell where you should be checking if the player has enough rebirths.

0

ok