I want to achive a function that kills the player.
So far i have:
local killplr =
Ik I need to start like this but don’t know how to continue.
I’ve searched the DevHub, EducationHub, devForum and YT.
I want to achive a function that kills the player.
So far i have:
local killplr =
Ik I need to start like this but don’t know how to continue.
I’ve searched the DevHub, EducationHub, devForum and YT.
local killPlr = function(Object)
if Object.Parent:FindFirstChild("Humanoid") then
Object.Parent:BreakJoints()
end
end
game.Workspace.Platform.Touched:Connect(killPlr)
There are many ways you could kill a player, this is one of them
Thanks! But actually, the script isn’t to do kill brick, it’s to make skip stage on obby.
MPS = game:GetService("MarketplaceService")
local killplr =
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
--where kill script will go
end
end
That’s what I have sor far. The point is, that the player touches the button on the screen, and then, the stage value goes up +1, then since teleporting a player is complex, since tha value is allready changed, the player dies and apperars in the next checkpoint.
local function Killer(Target)
Target:BreakJoints()
end
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(char)
task.wait(1)
Killer(char)
end)
end)
This one kills a player everytime he respawns/joins
Oh, why’d you want to kill the player then?
you could tp him to the next stage as he’s full healthy
Tp is complex for me, i’ve tried, trust me.
Unless you have a script i could use, i prefer killing the plr
It’s okay, I’ll explain it to you :
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
receiptInfo.PlayerId.Character:MoveTo(game.Workspace.Stages[player.leaderstats.Stage.Value].Position)
end
end
Basically, character is also a child of PlayerId
Just set the PrimaryPart CFrame of the player to wherever you want to tp the player
He could do either that, or use MoveTo, or set the CFrame of the player’s HumanoidRootPart, depends on his choice, but yeah.
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
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?