Local Script:

local replicatedStorage = game:GetService("ReplicatedStorage")
local starterRebirthAmount = 5000

local player = game.Players.LocalPlayer
local mainFrame = script.Parent:WaitForChild("MainFrame")
local rebirthMenu = mainFrame:WaitForChild("RebirthMenu")
local mainButton = script.Parent:WaitForChild("MainButton")
local rebirthButton = rebirthMenu:WaitForChild("RebirthButton")
local strengthToRebirth = rebirthMenu:WaitForChild("StrengthToRebirth")
local rebirths = player:WaitForChild("leaderstats").Rebirths

strengthToRebirth.Text = "You need at least ".. math.floor((starterRebirthAmount + (rebirths.Value) * math.sqrt(50000000))).." strength to rebirth!"

mainButton.MouseButton1Click:Connect(function()
	mainFrame.Visible = not mainFrame.Visible
end)

rebirthButton.MouseButton1Click:Connect(function()
 	local result = replicatedStorage.Remotes.Rebirth:InvokeServer()
	
	if result == true then
		
		rebirthButton.Text = "Successfully Rebirthed!"
		wait(1)
		rebirthButton.Text = "CLICK HERE TO REBIRTH!"
		elseif result == "NotEnoughStrength" then
			rebirthButton.Text = "Not Strong Enough!"
		wait(1)
		rebirthButton.Text = "CLICK HERE TO REBIRTH!"
	end
end)

rebirths:GetPropertyChangedSignal("Value"):Connect(function()	
	strengthToRebirth.Text = "You need at least".. math.floor((starterRebirthAmount + (rebirths.Value) * math.sqrt(50000000))).."strength to rebirth!"
end)

Remotes Script:

local replicatedStorage = game:GetService("ReplicatedStorage")
local remoteData = game:GetService("ServerStorage"):WaitForChild("RemoteData")
local starterRebirthAmount = 5000

local cooldown = 1

replicatedStorage.Remotes.Lift.OnServerEvent:Connect(function(player)
	
	print("Fired")
	
	if not remoteData:FindFirstChild(player.Name) then return "NoFolder" end
	
	
	
	local debounce = remoteData[player.Name].Debounce
	
	if not debounce.Value then
print("got past something")
		debounce.Value = true
		
		player.leaderstats.Strength.Value = player.leaderstats.Strength.Value + 5000 * (player.leaderstats.Rebirths.Value + 1)
		
		wait(cooldown)
		
		debounce.Value = false
		else
	end
end)

replicatedStorage.Remotes.Rebirth.OnServerInvoke = function(player)
	
	if not remoteData:FindFirstChild(player.Name) then return "NoFolder" end
	
	local rebirths = player.leaderstats.Rebirths
	
	if player.leaderstats.Strength >= (math.floor((starterRebirthAmount + (rebirths.Value) * math.sqrt(50000000)))) then
		
	rebirths.Value = rebirths.Value + 1
	
	player.leaderstats.Strength = 0
	
	player:LoadCharacter()
	
	return true
	
	else return "NotEnoughStrength"
end
end

Stats Script:

local serverStorage = game:GetService("ServerStorage")
local DataStore = game:GetService("DataStoreService"):GetDataStore("PlayerSave3")
game.Players.PlayerAdded:Connect(function(player)
	
	local leaderstats = Instance.new("Folder")
	leaderstats.Name = "leaderstats"
	leaderstats.Parent = player
	
	local strength = Instance.new("NumberValue")
	strength.Name = "Strength"
	strength.Parent = leaderstats
	
	local rebirths = Instance.new("IntValue")
	rebirths.Name = "Rebirths"
	rebirths.Parent = leaderstats
	
	
	local dataFolder = Instance.new("Folder")
	dataFolder.Name = player.Name
	dataFolder.Parent = serverStorage.RemoteData
	
	local debounce = Instance.new("BoolValue")
	debounce.Name = "Debounce"
	debounce.Parent = dataFolder
	
	local strengthData, rebirthsData
	
	local success,errormessage = pcall(function()
		strengthData = DataStore:GetAsync("strength-"..player.UserId)
		rebirthsData = DataStore:GetAsync("rebirths-"..player.UserId)
		end)
	
	if success then
		if strengthData then
			strength.Value = strengthData
			rebirths.Value = rebirthsData
		end
	end
	
	player.CharacterAppearanceLoaded:Connect(function(character)
		local humanoid = character.Humanoid
		humanoid:WaitForChild("BodyDepthScale").Value = 5 * (strength.Value / 250)
		humanoid:WaitForChild("BodyHeightScale").Value = 5 * (strength.Value / 250)
		humanoid:WaitForChild("BodyWidthScale").Value = 5 * (strength.Value / 250)
		humanoid:WaitForChild("HeadScale").Value = 5 * (strength.Value / 250)
		humanoid.Walkspeed = 16 * (strength.Value / 250)
		
			strength:GetPropertyChangedSignal("Value"):Connect(function()
			humanoid:WaitForChild("BodyDepthScale").Value = 5 * (strength.Value / 250)
			humanoid:WaitForChild("BodyHeightScale").Value = 5 * (strength.Value / 250)
			humanoid:WaitForChild("BodyWidthScale").Value = 5 * (strength.Value / 250)
			humanoid:WaitForChild("HeadScale").Value = 5 * (strength.Value / 250)
			humanoid.Walkspeed = 16 * (strength.Value / 250)
		end)
	end)
	
	game.Players.PlayerRemoving:Connect(function(player)
		local success, errormessage = pcall(function()
			DataStore:SetAsync("strength-"..player.UserId, player.leaderstats.Strength.Value)
			DataStore:SetAsync("rebirths-"..player.UserId, player.leaderstats.Rebirths.Value)
	end)
		
		end)
			end)

Module Script:

local module = {}
local replicatedStorage = game:GetService("ReplicatedStorage")

function module.Lift()
	
	replicatedStorage.Remotes.Lift:FireServer()
	
end

return module

Another Local Script:

local module = require(script.Parent:WaitForChild("ModuleScript"))
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()

script.Parent.Activated:Connect(function()
	
	module.Lift()
	
end)

if anyone can figure what's the problem please tell me!

4 comments

1

I really wished people would preview their message before posting

0

I really wished people would preview their message before posting

0

xD

0

edit:- fixed codeblock