Hello, i was thinking how do i make face changer, i made everything except the script. Please help.
I’m not going to do everything for you but I’ll give you a rough idea of what you need to do. You need to learn how to use RemoteEvents. RemoteEvent | Roblox Creator Documentation
In a Local Script in the GUI you’d put the following:
for i,v in ipairs(script.Parent.ScrollingFrame:GetChildren()) do — loops through image buttons frame
if v:IsA(“ImageButton”) then — checks to make sure is a face
v.MouseButton1Click:Connect(function() -- when the face is clicked this function runs
-- You need to look at RemoteEvent tutorials and fire one here
-- e.g FaceEvent:FireServer(v.Image) -- sends the asset ID of the face to the server
end)
end
Then in a server script you’d put something of the following
FaceEvent.OnServerEvent:Connect(function(plr, face)
plr.Character.Head.Decal.Texture = face-- this function can be written better to make sure the character exists.. Just an example of how to change the decal
end)
local players = game:GetService("Players")
local storage = game:GetService("ServerStorage")
local angryDecal = storage:WaitForChild("AngryDecal")
local bruh1Decal = storage:WaitForChild("Bruh1Decal")
local bruh2Decal = storage:WaitForChild("Bruh2Decal")
local creepyDecal = storage:WaitForChild("CreepyDecal")
local faceUi = script.Parent.Parent
local facesLabel = script.Parent
local angryFace = facesLabel:WaitForChild("ScrollingFrame"):WaitForChild("Angry")
local bruhFace1 = facesLabel:WaitForChild("ScrollingFrame"):WaitForChild("Bruh")
local bruhFace2 = facesLabel:WaitForChild("ScrollingFrame"):WaitForChild("Bruh 2")
local creepyFace = facesLabel:WaitForChild("ScrollingFrame"):WaitForChild("Creepy")
players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
angryFace.MouseButton1Click:Connect(function()
local head = character:WaitForChild("Head")
if head:FindFirstChild("face") then
head:FindFirstChild("face"):Destroy()
local angryDecalClone = angryDecal:Clone()
angryDecalClone.Parent = head
end
end)
bruhFace1.MouseButton1Click:Connect(function()
local head = character:WaitForChild("Head")
if head:FindFirstChild("face") then
head:FindFirstChild("face"):Destroy()
local bruh1DecalClone = bruh1Decal:Clone()
bruh1DecalClone.Parent = head
end
end)
bruhFace2.MouseButton1Click:Connect(function()
local head = character:WaitForChild("Head")
if head:FindFirstChild("face") then
head:FindFirstChild("face"):Destroy()
local bruh2DecalClone = bruh2Decal:Clone()
bruh2DecalClone.Parent = head
end
end)
creepyFace.MouseButton1Click:Connect(function()
local head = character:WaitForChild("Head")
if head:FindFirstChild("face") then
head:FindFirstChild("face"):Destroy()
local creepyDecalClone = creepyDecal:Clone()
creepyDecalClone.Parent = head
end
end)
end)
end)