-
What do you want to achieve? I want to know how I can change body parts of my character (For example: Using woman package parts) when Clicking a GUI Button
-
What is the issue? Script not working, nothing happens and I’m really newbie with scripting and I tried my best but I’m too dumb. I already connected the ClientEvent with the ServerEvent, the only problem is that I don’t know how to change my torso, arms and legs when clicking in the button.
-
What solutions have you tried so far?
1 Like
Don’t wrap the player added event in the remote event as it prevents it from getting the current players on the server.
4 Likes
Sorry if the question is too dumb (I’m really new with scripting) But how exactly would I do this? I would just remove it from the remove event and then call the entire function (when finished) in the remove event after?
I am pretty sure this is how you would do it instead.
morphEvent.OnServerEvent:Connect(function(player:Player)
local Character:Model = player.Character
if Character then
local Humanoid:Humanoid = Character:FindFirstChild("Humanoid")
if Humanoid then
local HumanoidDescription:HumanoidDescription = Humanoid:FindFirstChild("HumanoidDescription"):Clone()
for i, v in pairs(Changes) do
HumanoidDescription[i] = v
end
Humanoid:ApplyDescription(HumanoidDescription)
end
end
end)
Use Humanoid:GetAppliedDescription() instead of Clone:
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local morphEvent = ReplicatedStorage.MorphEvent
local changes = {
["LeftArm"] = 139607570
}
morphEvent.OnServerEvent:Connect(function(player)
local humanoid = player.Character.Humanoid
local desc = humanoid:GetAppliedDescription()
for property, id in pairs(changes) do
desc[property]= id
end
humanoid:ApplyDescription(desc)
end)
You might want to ensure that the character exists!
Yeah I was just focusing on the core aspect of the solution to keep the example straightforward
1 Like