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

I'm trying to add if the player is in group, it will do this. I can't figure it out? [SOLVED]

Can you add it for me? I can't figure out how to do it.

local debounce = false

function onTouch(hit)
if hit == nil then return end
if hit.Parent == nil then return end
if not game.Workspace:FindFirstChild("Home"..hit.Parent.Name) then
if game.Players:findFirstChild(hit.Parent.Name) ~= nil and debounce == false then
debounce = true
local b = script.Parent.Parent:Clone()
b.Parent = game.Lighting
b.Name = "Home"..hit.Parent.Name
wait(.4)
script.Parent.Parent.OwnerName.Value = hit.Parent.Name
script.Parent.Head:Remove()
script.Parent.Parent.Thing.Head.SurfaceGui.TextLabel.Text = "Home Owner: "..hit.Parent.Name
script.Parent.Parent.Parent.Name = "Home"..hit.Parent.Name
end
else
end
wait(3)
debounce = false
end

script.Parent.Head.Touched:connect(onTouch)

1 comment

1 answer

✓ Accepted answer

Well, I'm presuming you want them to be in the group to get the house of some sort.

local debounce = false
local ID = 1337 -- Group ID

function onTouch(hit)
	if hit == nil then return end
	if hit.Parent == nil then return end
	if not game.Workspace:FindFirstChild("Home"..hit.Parent.Name) then
		if game.Players:findFirstChild(hit.Parent.Name) ~= nil and debounce == false and game.Players:GetPlayerFromCharacter(hit.Parent):IsInGroup(ID) then
			debounce = true
			local b = script.Parent.Parent:Clone()
			b.Parent = game.Lighting
			b.Name = "Home"..hit.Parent.Name
			wait(.4)
			script.Parent.Parent.OwnerName.Value = hit.Parent.Name
			script.Parent.Head:Remove()
			script.Parent.Parent.Thing.Head.SurfaceGui.TextLabel.Text = "Home Owner: "..hit.Parent.Name
			script.Parent.Parent.Parent.Name = "Home"..hit.Parent.Name
		end
			else
		end
	wait(3)
	debounce = false
end

script.Parent.Head.Touched:connect(onTouch)

1 comment

0

Ah. Thanks.

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