I’m sorry if this is the wrong category (Please tell me If It is or is not so I can move this if so), but I’m wondering If theres a way to code a script that changes a players face depending on a certain area they’re in
Definitly, there’s many ways to detect player entering a certain area (raycast, region3, zoneplus module, touch events)
And to change the face we can use the simple way of Touch and do what we want with it for example:
local area = script.Parent --area path (variable)
area.Touched:Connect(function(hit) -- hit is the part that touched the area
local humanoid = hit.Parent:FindFirstChild("Humanoid")
if humanoid then
local head = hit.Parent.Head
local decal = head.face -- i don't really remember the name might be decal, face or Decal
decal.Texture = "rbxassetid://6699420" -- change the number to your face id
end
end)
ps: for reversing the face after player leaves the area you can use this code:
local area = script.Parent --area path (variable)
local face
area.Touched:Connect(function(hit) -- hit is the part that touched the area
local humanoid = hit.Parent:FindFirstChild("Humanoid")
if humanoid then
local head = hit.Parent.Head
local decal = head.face-- i don't really remember the name might be decal, face or Decal
face = decal.Texture
decal.Texture = "rbxassetid://6699420" -- change the number to your face id
end
end)
area.ToucheEnded:Connect(function(hit) -- hit is the part that touched the area
local humanoid = hit.Parent:FindFirstChild("Humanoid")
if humanoid and face then
local head = hit.Parent.Head
local decal = head.face-- i don't really remember the name might be decal, face or Decal
decal.Texture = face
face = nil
end
end)
1 Like
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.