How do I make this script local player so that others cant go through when someone buys it and that the purchase stays forever? Here is the script : What do I add or delete

local required_points = 2000

local db = true
script.Parent.Touched:Connect(function(hit)
	if hit.Parent:FindFirstChild("Humanoid") then
		local player = game.Players:GetPlayerFromCharacter(hit.Parent)
		if player.leaderstats.Coins.Value >= required_points then
			if db then
				db = false
				script.Parent.Transparency = 0.5
				script.Parent.CanCollide = false
				wait (3)
				script.Parent.CanCollide = true
				script.Parent.Transparency = 0
				db = true
				script.Parent.CanCollide = true
				player.leaderstats.Coins.Value = player.leaderstats.Coins.Value - 2000
			end
		else
			player.Character.Humanoid.Health = 0
		end
	end
end)

2 comments

0

If you made the script, you would clearly know how to "make it stay forever" since it takes more effort to disappear after 3 seconds. I think you copy pasted this script which is a no no

0

Well im not the scripter on my group and the one we have seems to not know it you didnt help at all