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

How do I make "dirt" that generates randomly ?

Doing this because I have a group/game that has something to do with Janitors so, how do I make it so that they click on the "dirt" block and it goes away but after like 5 mins it would generate again.

2 comments

0

^ Message me on ROBLOX, I might be able to come up with a better system

0

Edited my answer

1 answer

✓ Accepted answer

You would need to use a ClickDetector and the actual part.

--An example includes

script.Parent.ClickDetector.MouseClick:connect(function(playerWhoClicked)
	script.Parent.ClickDetector.MaxActivationDistance = 0 --'Disables' clicking
	script.Parent.Transparency = 1 --Transparent
	wait(300) --Wait 5 minutes
	script.Parent.Transparency = 0 --Opaque
	script.Parent.ClickDetector.MaxActivationDistance = 32 --Default distance
end)

Edit

local group = 2718024
local rank = 3

script.Parent.ClickDetector.MouseClick:connect(function(playerWhoClicked)
	if playerWhoClicked:GetRankInGroup(group) >= rank then --Checks whether the player meets these conditions
		script.Parent.ClickDetector.MaxActivationDistance = 0 --'Disables' clicking
		script.Parent.Transparency = 1 --Transparent
		wait(300) --Wait 5 minutes
		script.Parent.Transparency = 0 --Opaque
		script.Parent.ClickDetector.MaxActivationDistance = 32 --Default distance
	end
end)

5 comments

0

Did not work rip

0

Huh, worked for me. You made sure the Script & ClickDetector are in the same part?

0

Works thank you! Do you know how I can make it so only a "Janitor" rank can only click on it ect, the rank is called "Janitor" group ID is "2718024" and the rank value is "3"

0

Appreciate it! I tested it with my friend (that is not in the group & not the appropriate rank but he can still click it

0

Never mind! Thank you so much! :)

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