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

How to make a script for a block to walk through it when you have the required points?

This is my script but it isn't working and I don't know why

local required_points = 5

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.Points.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

		end

		player.Character.Humanoid.Health = 0

	end

end

end)

2 comments

0

if db == true then

0

the player.Character.Humanoi.Health = 0 command should go in an else block with if db

1 answer

Idk try this

script.Parent.Touched:Connect(function()
	local player = game.Players.LocalPlayers
	local required = 0 --requiered amount here
	local debounce = true
	if player.leaderstats.Points.Value == required or player.leaderstats.Points.Value >= required and debounce == true then
		debounce = false
		script.Parent.CanCollide = false
		wait (1)
		debounce = true
		script.Parent.CanCollide = true
	else
		player.Character.Humanoid.Health = 0
	end
end)

2 comments

0

It says that leaderstats isn't a proper member of part

0

hmmm, maybe try this updated version?

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