Help with kill player function

local reload = false -- LoadCharacter (Instant Respawn)
local breakj = true -- BreakJoints (Break Character)

local function kill(target)
     if breakj == true then
          target.Character:BreakJoints()
     elseif reload == true then
         target:LoadCharacter()
     end
end

-- wait for function
kill(player)

--// As a script IN ServerScriptService
1 Like

Simple

local Player = game.Players.LocalPlayer
local Character = Player.Character

MPS.ProcessReceipt = function(receiptInfo)
	if receiptInfo.ProductId == 1247673078 then
		local player = game.Players:GetPlayerByUserId(receiptInfo.PlayerId)
		player.leaderstats.Stage.Value = player.leaderstats.Stage.Value + 1
	
        Humanoid.Health = 0
	end
end

The thing is, why would you want to kill someone who’s bought skip stage, he’ll be respawned at the spawnpoint, and he then would realize he spent robux for nothing.

Only if you’d respawn him at the next stage[that he skipped to], then it’s fine.

He is adding 1 to stage value. There is probably another script that teleports you to the checkpoint with name of stage value.

That’s exactly what i want! Sorry if it wasn’t clear from the begining

I know what this line does, I talked about the killing part.

It’s fine, I knew what you meant, but I am kind of confused, don’t you want the player who’s bought it to be immediately teleported to the next stage? Instead of dying and respawning?

From what I see from other posts your looking for a skip stage thingy here

local MPS = game:GetService("MarketService")
local productid = 123456789
local stage = path.to.stage.place

MPS.ProcessReceipt = function(receiptInfo)
	if receiptInfo.ProductId == productid then
		local player = game.Players:GetPlayerByUserId(receiptInfo.PlayerId)
		player.Character:PivotTo(stage.CFrame)
	end
end
2 Likes

The player will respawn on the next stage, if you know what that line means.

I would like him to teleport, but It took months to get that done so I thaught, lets just kill the player and make him respawn in the next stage

Also, you could shorten and replace
‘player.leaderstats.Stage.Value = player.leaderstats.Stage.Value + 1’

with
‘player.leaderstats.Stage.Value += 1’

1 Like

This is fine, but it would make him[the player] furious, because he’d want to be immediately teleported

Oh here

local stat = game.Players.Leaderstats.Stage
local MPS = game:GetService("MarketService")
local productid = 123456789
local stage = path.to.stage.place

MPS.ProcessReceipt = function(receiptInfo)
	if receiptInfo.ProductId == productid then
		local player = game.Players:GetPlayerByUserId(receiptInfo.PlayerId)
		player.Character:PivotTo(stage.CFrame)
        stage.Value = Stage.Value + 1
	end
end

-- // you just need to code the stage thingy \\ --
1 Like

I have this after all these posts: But i get an warning:
image

Try mine, and see if it works

local stat = game.Players.Leaderstats.Stage
local MPS = game:GetService("MarketService")
local productid = 123456789
local stage = path.to.stage.place

MPS.ProcessReceipt = function(receiptInfo)
	if receiptInfo.ProductId == productid then
		local player = game.Players:GetPlayerByUserId(receiptInfo.PlayerId)
		player.Character:PivotTo(stage.CFrame)
        stage.Value = Stage.Value + 1
	end
end

-- // you just need to code the stage thingy \\ --

You can’t say ‘Humanoid.Health’.

Instead do -
player.Character.Humanoid:TakeDamage(player.Character.Humanoid.MaxHealth)

1 Like

Or you could use BreakJoints() to immediately kill the character.

You can just set the Health property to 0.

You have several ways to kill a player, it doesn’t matter

It matters. If you use the TakeDamage function it wont deal damage if you have a ForceField. BreakJoints function is not even intended for use to kill the player.