Hi, i make a Character Editor and the Server Event is not working…
Here the local Script:
local Player = game.Players.LocalPlayer
local char = Player.Character or Player.CharacterAdded:Wait()
local cam = workspace.CurrentCamera
repeat wait() until cam.CameraSubject ~= nil
cam.CameraType = Enum.CameraType.Scriptable
cam.CFrame = workspace.CamPart.CFrame
if not char:FindFirstChild("Shirt") then
local newshirt = Instance.new("Shirt", char)
newshirt.Name = "Shirt"
end
if not char:FindFirstChild("Pants") then
local newpants = Instance.new("Pants", char)
newpants.Name = "Pants"
end
char.Humanoid.WalkSpeed = 0
char.Humanoid.JumpPower = 0
char.Archivable = true
local dummy = char:Clone()
dummy.Parent = game.Workspace
dummy:MoveTo(workspace.CSpawn.Position)
dummy:SetPrimaryPartCFrame(dummy.PrimaryPart.CFrame * CFrame.Angles(0,math.rad(180), 0))
-- Shirts --
local allshirts = game.ReplicatedStorage:WaitForChild("Costomization"):WaitForChild("Shirts"):GetChildren()
dummy:WaitForChild("Shirt").ShirtTemplate = allshirts[1].ShirtTemplate
script.Parent.Shirt.Current.Value = 1
script.Parent.Shirt.Next.MouseButton1Down:Connect(function()
script.Parent.Shirt.Current.Value = script.Parent.Shirt.Current.Value + 1
if script.Parent.Shirt.Current.Value > #allshirts then
script.Parent.Shirt.Current.Value = 1
end
dummy:WaitForChild("Shirt").ShirtTemplate = allshirts[script.Parent.Shirt.Current.Value].ShirtTemplate
end)
script.Parent.Shirt.Privious.MouseButton1Down:Connect(function()
script.Parent.Shirt.Current.Value = script.Parent.Shirt.Current.Value - 1
if script.Parent.Shirt.Current.Value < 1 then
script.Parent.Shirt.Current.Value = #allshirts
end
dummy:WaitForChild("Shirt").ShirtTemplate = allshirts[script.Parent.Shirt.Current.Value].ShirtTemplate
end)
-- Pants --
local allPants = game.ReplicatedStorage:WaitForChild("Costomization"):WaitForChild("Pants"):GetChildren()
dummy:WaitForChild("Pants").PantsTemplate = allPants[1].PantsTemplate
script.Parent.Pants.Current.Value = 1
script.Parent.Pants.Next.MouseButton1Down:Connect(function()
script.Parent.Pants.Current.Value = script.Parent.Pants.Current.Value + 1
if script.Parent.Pants.Current.Value > #allPants then
script.Parent.Pants.Current.Value = 1
end
dummy:WaitForChild("Pants").PantsTemplate = allPants[script.Parent.Pants.Current.Value].PantsTemplate
end)
script.Parent.Pants.Privious.MouseButton1Down:Connect(function()
script.Parent.Pants.Current.Value = script.Parent.Pants.Current.Value - 1
if script.Parent.Pants.Current.Value < 1 then
script.Parent.Pants.Current.Value = #allPants
end
dummy:WaitForChild("Pants").PantsTemplate = allPants[script.Parent.Shirt.Current.Value].PantsTemplate
end)
-- Finish --
script.Parent.Finish.MouseButton1Down:Connect(function()
game.ReplicatedStorage.Costomization.UpdateClothing:FireServer(char.Shirt.ShirtTemplate,char.Pants.PantsTemplate)
char.Humanoid.WalkSpeed = 16
char.Humanoid.JumpPower = 50
cam.CameraType = Enum.CameraType.Custom
script.Parent.Enabled = false
dummy:Destroy()
end)
and here the Server Script:
game.ReplicatedStorage.Costomization.UpdateClothing.OnServerEvent:Connect(function(Player, ShirtTemplate, PantsTemplate)
local char = Player.Character or Player.CharacterAdded:Wait()
char.Shirt.ShirtTemplate = ShirtTemplate
char.Pants.PantsTemplate = PantsTemplate
end)
plz help and have a great day!