You can write your topic however you want, but you need to answer these questions:
- What do you want to achieve? Keep it simple and clear!
I want it where when you choose the morph skin it well chnage your morph to a diffren morph - What is the issue? Include screenshots / videos if possible!
so when I buy the morph on my skin gui it when it switch the morph with the new one the camera kindof glitch I can see the moph walking but the camera not following the morph heres a video of the problem
- What solutions have you tried so far? Did you look for solutions on the Creator Hub?
I tryed using LoadCharacter() but that just reset my Character back to the default morph
hers my client script
local player = game.Players.LocalPlayer
local playerGui = player:WaitForChild("PlayerGui")
local screenGui = playerGui:WaitForChild("skins")
local SkinsFrame = screenGui:WaitForChild("Frame")
local SideBar = SkinsFrame:WaitForChild("sideBar")
local sidebarImage = SideBar:WaitForChild("ImageLabel")
local sidebarButton = SideBar:WaitForChild("TextButton")
local ScrollingFrame = SkinsFrame:WaitForChild("ScrollingFrame")
local morphEvent = game.ReplicatedStorage:WaitForChild("MorphEvent")
local skins = script.Parent
local TextButton = script.Parent.TextButton
local ownedSkins = {}
local equippedSkin = nil
local selectedSkin = nil
for _, frame in ipairs(ScrollingFrame:GetChildren()) do
if frame:IsA("Frame") then
local button = frame:FindFirstChildWhichIsA("TextButton")
local image = frame:FindFirstChildWhichIsA("ImageLabel")
if button and image then
button.MouseButton1Click:Connect(function()
selectedSkin = frame.Name
sidebarImage.Image = image.Image
SideBar.Visible = true
morphEvent:FireServer("CheckSkin", selectedSkin)
end)
end
end
end
sidebarButton.MouseButton1Click:Connect(function()
if not selectedSkin then return end
morphEvent:FireServer("SelectSkin", selectedSkin)
end)
morphEvent.OnClientEvent:Connect(function(action, skinName, status)
if action == "UpdateSidebar" and skinName == selectedSkin then
if status == "Owned" then
sidebarButton.Text = "Equip"
sidebarButton.BackgroundColor3 = Color3.fromRGB(0, 255, 0)
elseif status == "Equipped" then
sidebarButton.Text = "Equipped"
sidebarButton.BackgroundColor3 = Color3.fromRGB(202, 202, 202)
else
sidebarButton.Text = "Buy"
sidebarButton.BackgroundColor3 = Color3.fromRGB(0, 255, 0)
end
end
end)
TextButton.MouseButton1Click:Connect(function()
skins.Enabled = false
end)
and hers the server script
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")
local morphEvent = ReplicatedStorage:WaitForChild("MorphEvent")
local MorphsFolder = ReplicatedStorage:WaitForChild("Morphs")
local playerData = {}
Players.PlayerAdded:Connect(function(player)
playerData[player] = {
Owned = {},
Equipped = nil
}
end)
Players.PlayerRemoving:Connect(function(player)
playerData[player] = nil
end)
local function applyMorph(player)
local data = playerData[player]
if not data or not data.Equipped then return end
local morphModel = MorphsFolder:FindFirstChild(data.Equipped)
if not morphModel then return end
local char = player.Character or player.CharacterAdded:Wait()
local hrp = char:WaitForChild("HumanoidRootPart")
local newMorph = morphModel:Clone()
newMorph.Name = player.Name
newMorph.Parent = workspace
newMorph:SetPrimaryPartCFrame(hrp.CFrame)
if not newMorph:FindFirstChildOfClass("Humanoid") then
Instance.new("Humanoid", newMorph)
end
player.Character = newMorph
end
morphEvent.OnServerEvent:Connect(function(player, action, skinName)
local data = playerData[player]
if not data then return end
if action == "CheckSkin" then
if data.Equipped == skinName then
morphEvent:FireClient(player, "UpdateSidebar", skinName, "Equipped")
elseif data.Owned[skinName] then
morphEvent:FireClient(player, "UpdateSidebar", skinName, "Owned")
else
morphEvent:FireClient(player, "UpdateSidebar", skinName, "NotOwned")
end
elseif action == "SelectSkin" then
if not data.Owned[skinName] then
data.Owned[skinName] = true
end
data.Equipped = skinName
morphEvent:FireClient(player, "UpdateSidebar", skinName, "Equipped")
applyMorph(player)
end
end)