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

How can I make it to where a kill brick won't kill you if you have a certain gamepass?

I'm new to scripting and I'm currently making an obby. I've been trying to modify my kill brick script to where you won't die from it if you have a certain gamepass, but I can't figure it out.

Here's the script for the kill brick.

function onTouched(Obj)
	local h = Obj.Parent:FindFirstChild("Humanoid")
	if h then
		h.Health = 0
	end
end

script.Parent.Touched:Connect(onTouched)

1 answer

You need to add a script into ServerScriptService here is the code:

local id = (your gamepass Id with no parentheses )

game:GetService(¨MarketplaceService¨).PromptGamePassPurchaseFinished:Connect(functon(plr,ido,purchased)
if purchased and id == ido then
game.Workspace.Killpart.Script.Disabled = true
end
end)

game.Players.PlayerAdded:Connect(function(plr)
if game:GetService(¨MarketplaceService¨)UserOwnsGamePassAsync(plr.UserId.id) then
game.Workspace.Killpart.Script.Disabled = true
end
end)

Oh btw make sure the script in the kill part matches the name of script or you can change the server script thing to match the kill part script

2 comments

0

also the script in the kill part doesnt matter

0

It works, but only on one kill brick. I need the script to work on all kill bricks.

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