So, Still making a script for my friend. Now, My script isn't working at all! :( No output errors.
It is a normal script located in Workspace > TouchPart
UPDATED :
game.Workspace.TouchPart.Touched:Connect(function(hit) -- I will ignore your other code for now local part = script.Parent local debounce = false if hit.Parent:FindFirstChild("Humanoid") then -- will tell you if what hit it is a player local players = game:GetService("Players") local plar = players:GetPlayerFromCharacter(hit.Parent) -- getting the player from the players service by providing the character. if plar:IsInGroup(3467972) then if not debounce then debounce = true wait(1) part.BrickColor = BrickColor.Green() else part.BrickColor = BrickColor.Red() end debounce = false end end end)
You first have to Check if there's a Humanoid
, then find the player from game:GetService("Players")
local Part = script.Parent local debounce = true local players = game:GetService("Players") local groupid = 3467972 script.Parent.Touched:Connect(function(hit) -- This Would be easier by placing the script inside the part if debounce and hit.Parent:FindFirstChild("Humanoid") and players:FindFirstChild(hit.Parent.Name) then -- Checks if theirs a Humanoid debounce = false local plar = players:FindFirstChild(hit.Parent.Name) if plar:IsInGroup(groupid) then print(plar.Name.." Is In Group:"..groupid) wait(1) part.BrickColor = BrickColor.Green() else part.BrickColor = BrickColor.Red() end debounce = true end end)
Make sure you place this script inside the part.
Ok so here we go:
game.Workspace.TouchPart.Touched:Connect(function(hit) -- I will ignore your other code for now if hit.Parent:FindFirstChild("Humanoid") -- will tell you if what hit it is a player local players = game:GetService("Players") local plar = players:GetPlayerFromCharacter(hit.Parent) -- getting the player from the players service by providing the character. if if plar:IsInGroup(3467972) then
I hope this helps and have a great day scripting!