Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Something is going on with my script rebirth is not doing anything for a simulator game?

So I am watching a youtube video on how to make a simulator. (It's a bitcoin one). Nothing is working in my GUI and it's supposed to show up with a message. ****To sum it all up it is supposed to rebirth but it is not. I can't figure out how to fix it because nothing is showing up in the output.

My local script for the GUI~~~~~~~~~~~~~~~~~

local starterRebirthAmount = 10000

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 "..math.floor((starterRebirthAmount + rebirths.Value * math.sqrt(50000000))).. "bitcoins 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 == "NotEnoughBitcoins" then
		rebirthButton.Text = "Not enough Bitcoins!"
		wait (1)
		rebirthButton.Text = "CLICK HERE TO REBIRTH"
	end
end)

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

My script for the Remotes ~~~~~~~~~~~~~~~~~local replicatedStorage = game:GetService("ReplicatedStorage")
local remoteData = game:GetService("ServerStorage"):WaitForChild("RemoteData")
local starterRebirthAmount = 10000

local cooldown = 1

replicatedStorage.Remotes.Bitcoins.OnServerEvent:Connect(function(player)
	
	if not remoteData:FindFirstChild(player.Name)then return "NoFolder" end
	
	local debounce = remoteData[player.Name].Debounce
	
	if not debounce.Value then
		
		debounce.Value = true
		
		player.leaderstats.Bitcoins.Value = player.leaderstats.Bitcoins.Value + 10 * (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.Bitcoins.Value >= (math.floor((starterRebirthAmount + rebirths.Value * math.sqrt(50000000)))) then
		
		rebirths.Value = rebirths.Value + 1
		
		player.leaderstats.Bitcoins.Value = 0
		
		player:LoadCharacter()
		
		return true
	else return "NotEnoughStrength"
	end
end

Please help as I do not know what to do since there is no output.

By the way, it is an Alvinblox video

1 comment

0

Start by printing output first and identify what exactly is the problem area. Some of this code looks 100% alright and as such its just clutter that we don't need to see.

1 answer

I am fixing it here

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

local cooldown = 1

replicatedStorage.Remotes.Bitcoins.OnServerEvent:Connect(function(player)
	
	if not remoteData:FindFirstChild(player.Name)then return "NoFolder" end
	
	local debounce = remoteData[player.Name].Debounce
	
	if not debounce.Value then
		
		debounce.Value = true
		
		player.leaderstats.Bitcoins.Value = player.leaderstats.Bitcoins.Value + 10 * (player.leaderstats.Rebirths.Value + 1)
		
		wait(cooldown)
		
		debounce.Value = false
	else
		
	end
	
end)

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

The lua is not working so just read below

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

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 bitcoinsToRebirth = rebirthMenu:WaitForChild("StrengthToRebirth") local rebirths = player:WaitForChild("leaderstats").Rebirths

bitcoinsToRebirth.Text = "You need at "..math.floor((starterRebirthAmount + rebirths.Value * math.sqrt(50000000))).. "bitcoins 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 == "NotEnoughBitcoins" then
	rebirthButton.Text = "Not enough Bitcoins!"
	wait (1)
	rebirthButton.Text = "CLICK HERE TO REBIRTH"
end

end)

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

I had one of my friends try and fix this but it is still not working.

This discussion is preserved as it was. New answers, comments, and votes are closed.