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)
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