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

Take no damage from Killbricks when you have a specific gamepass?

I'm fairly new to scripting and I'm making a Obby, I'm trying to figure out a way to have a "Easy Mode" which would be not taking damage to KillBricks if you have a specific gamepass I'm also trying to make a GUI where you can toggle a button to turn Easy Mode on and off (only gamepass owners can use this feature)

script.Parent.Touched:Connect(function(hit)
	if hit and hit.Parent and hit.Parent:FindFirstChild("Humanoid") then
		hit.Parent.Humanoid.Health = 0
	end
end)

This is my killbrick script which works fine ^^^

local Id = 45525748
	game:GetService("MarketplaceService").PromptGamePassPurchaseFinished:Connect(function(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)

This was my previous script trying to make it It didn't work AT ALL either maybe someone could help me fix this script or just give me idea's

1 comment

0

add a Humanoid:TakeDamage(100) for ur first script instead of setting the player's health to 0, and for your other script make add a Humanoid:TakeDamage(0). this is easier than disabling the script

2 answers

local GamePassService = game:GetService('GamePassService')

local GamepassID = 45525748

if GamePassService:PlayerHasPass(game.Players.LocalPlayer, GamepassID) then
	
	game.Workspace.Killpart.Script.Disabled = true

end

This code needs to be in a LocalScript parented to StarterPlayerScripts.

This is untested. If it does not work, please tell me. Otherwise please accept the solution.

1 comment

0

Unfortunatly it didn't work

Put a BoolValue inside of all KillBricks. Then, you make a LocalScript inside StarterPlayer > StarterCharacterScripts. Inside the LocalScript it should be like this:

local plr = game.Players.LocalPlayer

local char = plr.Character or plr.CharacterAdded:wait() or script.Parent

local hum = char:WaitForChild("Humanoid")
hum.Touched:Connect(function(hit, limb)
	if hit:FindFirstChild("CanKillPlayer") and not char:FindFirstChild("IsImmortal") then
		if hum.Health > 0 and limb.Name ~= "Part" then
			hum.Health = 0
		end
	end
end)

Then, in a script inside ServerScriptService, put this code:

local Id = 45525748

game:GetService("MarketplaceService").PromptGamePassPurchaseFinished:Connect(function(plr,ido,purchased)
	if purchased and Id == ido then
		local BoolValue = Instance.new("BoolValue", plr.Character or plr.CharacterAdded:wait())
		BoolValue.Name = "IsImmortal"
	end
end)

game.Players.PlayerAdded:Connect(function(plr)
	if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(plr.UserId.Id) then
		local BoolValue = Instance.new("BoolValue", plr.Character or plr.CharacterAdded:wait())
		BoolValue.Name = "IsImmortal"
	end
end)

That's all of it! I hope it works and lemme know if there are mistakes or errors. Have a good day! ^^

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