You can write your topic however you want, but you need to answer these questions:
What do you want to achieve? I want to press a GUI-Button to were headless, then agein to were my old head
What is the issue? The script do not work and do not show any error
What solutions have you tried so far? I tried to change between local and normal script (now its a script) and i tried to change the “head local”
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
local RemoveHead = script.Parent
local Head = game.Players.LocalPlayer.Character.Head.MeshId
local Headless = game.ReplicatedStorage.Headless.Value
game.ReplicatedStorage.CurrentHead.Value = Head
RemoveHead.MouseButton1Click:Connect(function()
if Head == Headless then
Head = game.ReplicatedStorage.CurrentHead.Value
else
Head = Headless
end
end)
I am a beginer scripter and want to learn. now i want to change the body part to make my game open for more.
You can change the transparency of their head and face with a simple script like this
local PlayerHead = workspace:FindFirstChild(player.Name):FindFirstChild("Head")
PlayerHead.Transparency = 1
if PlayerHead:FindFirstChild("face") then
PlayerHead:FindFirstChild("face").Transparency = 1
end
So many bad practices… Some of these are as follows:
Not using :GetService() for services
Writing .Value in your variables, etc.
local RemoveHead = script.Parent
local Head = game:GetService("Players").LocalPlayer.Character.Head
local Headless = game:GetService("ReplicatedStorage").Headless
game:GetService("ReplicatedStorage").CurrentHead.Value = Head.Value
RemoveHead.MouseButton1Click:Connect(function()
if Head.MeshId == Headless.Value then
Head.MeshId = game:GetService("ReplicatedStorage").CurrentHead.Value
else
Head.MeshId = Headless.Value
end
end)
Edit:
I just realized that you can’t change the head meshid as it is restricted, you should do what @disphoticzone said and set the transparency of the head and face to 1
I have no idea… im a poor scripter and i spen the last 1.5 hour trying to figgure this out by useing the scripts abov and youtube. I have no ide how more then the very basics work and i dident even find a totorial.
Ye, idk i tried eveerything but i still dont get it. i get no errors and i dont know how to find out whats wrong for me it looks right but probobly isent so i got no clue…
You can use a HumanoidDescription to seamlessly integrate different outfits to your players.
There’s a lot of code here, but i’ll try to follow up with any questions you have. But pretty much consider “HumanoidDescriptions” as ways of describing how a character should look. We use the Humanoid to actually apply the HumanoidDescriptions.
I’ve decided to go with two HumanDescriptions, one description that describes how the player looks when they first join the game, and then another one that describes how they should look with the headless outfit applied to them. I stored both of these values in ServerStorage. Once the players are removed, the descriptions in ServerStorage will also be removed to avoid clutter.
In a Script in ServerScriptService:
local Players = game:GetService("Players")
local ServerStorage = game:GetService("ServerStorage")
local HEADLESS_HEAD_ID = 134082579
game:GetService("ReplicatedStorage").ApplyCharacterDescription.OnServerEvent:Connect(function(PlayerRequestingDescription, RequestedDescription)
if RequestedDescription == "Headless" then
local Description = ServerStorage:FindFirstChild("Headless_" .. PlayerRequestingDescription.UserId)
if Description then
PlayerRequestingDescription.Character.Humanoid:ApplyDescription(Description)
end
elseif RequestedDescription == "Normal" then
local Description = ServerStorage:FindFirstChild("Normal_" .. PlayerRequestingDescription.UserId)
if Description then
PlayerRequestingDescription.Character.Humanoid:ApplyDescription(Description)
end
end
end)
Players.PlayerAdded:Connect(function(PlayerThatJoined)
PlayerThatJoined.CharacterAdded:Connect(function(CharacterThatJoined)
local NormalDescription = CharacterThatJoined.Humanoid:GetAppliedDescription()
NormalDescription.Name = "Normal_"..PlayerThatJoined.UserId
NormalDescription.Parent = ServerStorage
local HeadlessDescription = CharacterThatJoined.Humanoid:GetAppliedDescription()
HeadlessDescription.Head = HEADLESS_HEAD_ID
HeadlessDescription.Face = 0
HeadlessDescription.Name = "Headless_"..PlayerThatJoined.UserId
HeadlessDescription.Parent = ServerStorage
end)
end)
Players.PlayerRemoving:Connect(function(PlayerBeingRemoved)
local FoundDescriptionHeadless = ServerStorage:FindFirstChild("Headless_"..PlayerBeingRemoved.UserId)
if FoundDescriptionHeadless then
FoundDescriptionHeadless:Destroy()
end
local FoundDescriptionNormal = ServerStorage:FindFirstChild("Normal_"..PlayerBeingRemoved.UserId)
if FoundDescriptionNormal then
FoundDescriptionNormal:Destroy()
end
end)
In a LocalScript under some button:
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Count = 0
script.Parent.MouseButton1Down:Connect(function()
Count += 1
if Count % 2 == 0 then
ReplicatedStorage.ApplyCharacterDescription:FireServer("Headless")
else
ReplicatedStorage.ApplyCharacterDescription:FireServer("Normal")
end
end)
and without completely removing the head, possibly breaking other scripts they have ingame, such as an overhead title gui.
Edit: Just realised that wasn’t a reply but a mention, thought you were mentioning my code, but still, while :GetService() is a better practice, they only wants basic lua for now it seems.