Server Script: (ServerScriptService)
replicatedStorage.Respawn.OnServerEvent:Connect(function(player)
player:LoadCharacter()
end)
replicatedStorage.CheckLoad.OnServerEvent:Connect(function(player, bool, morph)
local value1 = player:WaitForChild('Loaded')
local value2 = player:WaitForChild('Morph')
if bool == false then
value2.Value = nil
value1.Value = false
player.TeamColor = BrickColor.new('Institutional white')
player:LoadCharacter()
else
value1.Value = true
if morph then
value2.Value = morph
end
end
end)
replicatedStorage.TeamPlayer.OnServerEvent:Connect(function(player, TeamColor)
player.TeamColor = TeamColor
end)
replicatedStorage.SetMorphValue.OnServerEvent:Connect(function(player, morph, tools)
local character = player.Character or player.CharacterAdded:Wait()
local value1 = player:WaitForChild('Morph')
value1.Value = morph
player.CharacterAdded:Connect(function(character)
if player.Loaded.Value == true and player.Morph.Value ~= nil then
replicatedStorage.MorphService.morphCharacterAsServer:Fire(player, player.Character or player.CharacterAdded:Wait(), value1.Value)
local shirt = morph.Character:FindFirstChild('Shirt'):Clone()
local pants = morph.Character:FindFirstChild('Pants'):Clone()
if shirt then
if character:FindFirstChild('Shirt') then character.Shirt:Destroy() end
shirt.Parent = character
end
if pants then
if character:FindFirstChild('Pants') then character.Pants:Destroy() end
pants.Parent = character
end
for i,v in pairs(tools:GetChildren()) do
if v:IsA('Tool') then
v:Clone().Parent = player.Backpack
end
end
end
end)
end)
Local Script: (StarterPlayerScripts)
morphSelector.Deploy.MouseButton1Click:Connect(function()
-- Starting to deploy
local character = localplayer.Character or localplayer.CharacterAdded:Wait()
if menu:FindFirstChild('Morph') then menu.Morph:Destroy() end
morphSelector.Enabled = false
tweenService:Create(localplayer.PlayerGui.HideScreen.Hide, TweenInfo.new(1), {BackgroundTransparency = 0}):Play()
camera.CameraType = Enum.CameraType.Custom
camera.CameraSubject = character:WaitForChild('HumanoidRootPart')
camera.CFrame = character.HumanoidRootPart.CFrame
game["Run Service"].Stepped:Connect(function()
if localplayer.Loaded.Value == true then
camera.CameraType = Enum.CameraType.Custom
camera.CameraSubject = localplayer.Character
end
end)
script.MorphSelected.Value = false
task.wait(1)
-- Checking Variables
if type(morphSelected) ~= 'string' then
game.ReplicatedStorage.SetMorphValue:FireServer(morphSelected.Morph, morphSelected.Tools)
game.ReplicatedStorage.CheckLoad:FireServer(true, morphSelected.Morph)
else
game.ReplicatedStorage.CheckLoad:FireServer(true)
end
game.ReplicatedStorage.TeamPlayer:FireServer(teamSelected.TeamColor)
task.wait(1)
-- Preparing to deploy
tweenService:Create(localplayer.PlayerGui.HideScreen.Hide, TweenInfo.new(1), {BackgroundTransparency = 1}):Play()
toggleNormalScreen(true)
game.ReplicatedStorage.Respawn:FireServer()
localplayer.PlayerGui.ArrestGUI.Enabled = false
script.MenuSound.Playing = false
end)
localplayer.CharacterAdded:Connect(function(character)
initialize(localplayer.Character or localplayer.CharacterAdded:Wait())
end)
localplayer.PlayerGui.MenuGUI.AlertMenu.Confirm.MouseButton1Click:Connect(function()
initialize(localplayer.Character or localplayer.CharacterAdded:Wait())
game.ReplicatedStorage.CheckLoad:FireServer(false)
morphSelected = nil
teamSelected = nil
script.MorphSelected.Value = false
turnWhite()
morphSelector.Selected.Text = 'Selected: N/A'
if menu:FindFirstChild('Morph') then menu.Morph:Destroy() end
for i,v in pairs(morphSelector.MorphSelectionButtons:GetChildren()) do
if v:IsA('Frame') then
v.Visible = false
end
end
end)
Questions
-
What are you trying to acheive?
I’m trying to make a server script changes the value from player but it still gives the same clothing. -
Do you have solutions? Have you search on https://developer.roblox.com/?
No. I have solutions but they didn’t work, the first one is make new argument as what player is giving morph, there is cloth, but when I go back to menu and change other ones with different clothing, and I click “deploy”, it gives same clothing not the clothing that what I use a different morph.
Video
(3) Central Omicron Border Roblox Studio 2022 03 18 11 52 39 - YouTube
As you can see, the video represents my game, then when I click the 1st uniform, It gives correctly, when I go back to menu and select other with different clothing, it gives me same clothing in 1st uniform.
How do I fix this?
Free feel to advice me that is not relate to my issue.
Thank you.