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

Ro-Rap Battles// My code wont work such as values not changing?

local rap_time = 35
local player_going = game.Workspace.RoRapBattles.PlayerUp.Value
local raptime = game.Workspace.RoRapBattles.RapTime
local lobby_intermission_time = 20
local bar = game.Workspace.RoRapBattles.Bar.Value
local againplr2 = game.Players:GetPlayers()[math.random(1,#game.Players:GetPlayers())]

-- Rap Time Main countdown
while true do
	raptime.Value = raptime.Value -1
		
	if raptime == 0 and player_going == 0 then -- Intermission over
			-- Random Player Picker!
			-- Player 1
		local plr1 = game.Players:GetPlayers()[math.random(1,#game.Players:GetPlayers())]
		print(plr1.Name.." Is going up")
		local rapper1 = game.Workspace.RoRapBattles.Player1.Value
		rapper1 = plr1.Name
			
			
			--Player 2 chooser
			
		local plr2 = game.Players:GetPlayers()[math.random(1,#game.Players:GetPlayers())]
		if plr2.Name == plr1.Name then
			print(againplr2.Name)
			local rapper3 = game.Workspace.RoRapBattles.Player2.Value
			rapper3 = againplr2.Name
		end 
			
		print(plr2.Name.." Is going up")
		local rapper2 = game.Workspace.RoRapBattles.Player1.Value
		rapper1 = plr1.Name
			
			----------------------------
		player_going = 1
		bar = rapper1.Value.." V.S "..rapper2.Value
		wait(3)
		-- Teleport/Walkspeed
		game.Players:FindFirstChild(rapper1).Character.HumanoidRootPart.CFrame = CFrame.new(-172.35, 4.9, 20.5)
		game.Players:FindFirstChild(rapper1).Character.Humanoid.Walkspeed = 0
			
		game.Players:FindFirstChild(rapper2).Character.HumanoidRootPart.CFrame = CFrame.new(-172.35, 4.9, 32.7)
		game.Players:FindFirstChild(rapper2).Character.Humanoid.Walkspeed = 0			
			
			
			
		wait(3)
		raptime.Value = rap_time
		bar = rapper1.Value.." is rapping("..raptime.Value..")"
		local beat = game.Workspace.RoRapBattles.Beat
		beat:Play()
		if raptime == 0 and player_going == 1 then
			beat:Stop()
			bar = "Homie, can ya come back from that."
			wait(3)
			player_going = 2
			raptime.Value = rap_time
			bar = rapper2.Value.." is rapping("..raptime.Value..")"
			beat:Play()
				
			if raptime == 0 and player_going == 2 then
				bar = "HOMIE, its time to vote."
				local vote = game.ReplicatedStorage.VoteGui:Clone()
				vote.Parent = game.Players.LocalPlayer.PlayerGui
				wait(10) -- Vote it
				game.Players.LocalPlayer.PlayerGui.VoteGui:Destroy()
				wait(1)
				if game.Workspace.Vote1.Value > game.Workspace.Vote2.Value then
					game.Players:FindFirstChild(rapper1).leaderstats.Wins.Value = game.Players:FindFirstChild(rapper1).leaderstats.Wins.Value +1
					game.Players:FindFirstChild(rapper1).leaderstats.Money.Value = game.Players:FindFirstChild(rapper1).leaderstats.Money.Value +86
					game.Workspace.KillPad:Destroy()
					game.Workspace.KillPad.Kill.Disabled = false
					game.Workspace.KillPad.Kill.Disabled =true						
				end -- Vote
					
				if game.Workspace.Vote2.Value > game.Workspace.Vote1.Value then
					game.Players:FindFirstChild(rapper2).leaderstats.Wins.Value = game.Players:FindFirstChild(rapper2).leaderstats.Wins.Value +1
					game.Players:FindFirstChild(rapper2).leaderstats.Money.Value = game.Players:FindFirstChild(rapper2).leaderstats.Money.Value +86
					game.Workspace.KillPad.Kill.Disabled = false
					game.Workspace.KillPad.Kill.Disabled = true
			 	end -- Vote
			end
		end	
	end
end

3 comments

0

ummm at the top to it has the code lol

0

fixed that for you. what values arent being changed?

0

all values

1 answer

rap_time is an int variable in the script, it is not being stored inside a object's value(such as intvalue,numbervalue), so you would change it by doing

rap_time = rap_time - 1

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