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

I get the error ATTEMPT TO CALL NIL VALUE when trying to hand out my badge when you win?

Here is the script for the jackpot

machine.SuperJPSensor.Touched:Connect(function(hit) -- Registers the ball reaching the Mega Jackpot hole
	if hit.Name == "Neptune_Ball" then
		sounds.MonsterJackpot2.Volume = 1
		muteMusic()
		button.Material = Enum.Material.SmoothPlastic
		wait(5)
		AwardBadge(game.Players:FindFirstChild(machine.CardReader.GameInfo.Player.Value), 2126797826)
		machine.Particle.ParticleEmitter.Enabled = true
		sounds.MonsterJackpot2:Play()
		wait(2)
		sounds.MonsterDropMonsterJackpotSong:Play()
		ticketOut(machine.Parent.MegaJackpotScreen.Value.Value)
		for i, v in pairs(game.Players:GetChildren()) do
			-- Change the player's stuff here
			v.PlayerGui.ScreenGui.Frame.TextLabel.Text = machine.CardReader.GameInfo.Player.Value .. " HAS WON " .. machine.Parent.MegaJackpotScreen.Value.Value .. " ON MONSTER DROP (1)"
		end
		for i = 1, 200 do
			Jpdisp.Parent.SurfaceGui.Enabled = true
			for _,a in pairs(SideLights:GetChildren()) do a.SurfaceLight.Enabled = true; a.Material = Enum.Material.Neon end
			wait(0.1)
			for _,a in pairs(SideLights:GetChildren()) do a.SurfaceLight.Enabled = false; a.Material = Enum.Material.SmoothPlastic end
			Jpdisp.Parent.SurfaceGui.Enabled = false
			wait(0.1)
		end
		Jpdisp.Value = MegaJPDefault
		for _,a in pairs(SideLights:GetChildren()) do a.SurfaceLight.Enabled = true; a.Material = Enum.Material.Neon end
		for i = 2, 0, -0.2 do
			sounds.MonsterJackpot2.Volume = i
			wait(0.1)
		end
		sounds.MonsterDropMonsterJackpotSong:Stop()
		machine.Particle.ParticleEmitter.Enabled = false
		Jpdisp.Parent.SurfaceGui.Enabled = true
		start()
		if machine.Credits.Value > 0 then button.Material = Enum.Material.Neon end
	end
end)

1 answer

hey you! have you ever heard of enes? if you are in trouble, better call enes!

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