I have a Local script inside of a Gui as well as two buttons (there are more than two but take note of the button named “HairButtonUp”, and “HairButtonDown”
The buttons hold a script that changes the number value for a text label.
I’m trying to make it so that the hair will change when there is a certain value. The hairs are inside of ServerScriptService:
And there are remote events in replicatedstorage corresponding to each hair name:
I also have a script inside of server script service (Both the local script and script down below)
Why won’t this work? I haven’t recieved any errors…
(Local Script):
local remote1 = game:GetService("ReplicatedStorage").Hair1
local remote2 = game:GetService("ReplicatedStorage").Hair2
local remote3 = game:GetService("ReplicatedStorage").Hair3
local remote4 = game:GetService("ReplicatedStorage").Hair4
local remote5 = game:GetService("ReplicatedStorage").Hair5
local remote6 = game:GetService("ReplicatedStorage").Hair6
-- hair button up
if script.Parent.HairButtonUp.Number.Value == 1 then
script.Parent.HairButtonUp.MouseButton1Click:Connect(function()
remote1:FireServer("ChangeHair")
end)
end
if script.Parent.HairButtonUp.Number.Value == 2 then
script.Parent.HairButtonUp.MouseButton1Click:Connect(function()
remote2:FireServer("ChangeHair")
end)
end
if script.Parent.HairButtonUp.Number.Value == 3 then
script.Parent.HairButtonUp.MouseButton1Click:Connect(function()
remote3:FireServer("ChangeHair")
end)
end
if script.Parent.HairButtonUp.Number.Value == 4 then
script.Parent.HairButtonUp.MouseButton1Click:Connect(function()
remote4:FireServer("ChangeHair")
end)
end
if script.Parent.HairButtonUp.Number.Value == 5 then
script.Parent.HairButtonUp.MouseButton1Click:Connect(function()
remote5:FireServer("ChangeHair")
end)
end
if script.Parent.HairButtonUp.Number.Value == 6 then
script.Parent.HairButtonUp.MouseButton1Click:Connect(function()
remote6:FireServer("ChangeHair")
end)
end
-- hair button down
if script.Parent.HairButtonUp.Number.Value == 1 then
script.Parent.HairButtonDown.MouseButton1Click:Connect(function()
remote1:FireServer("ChangeHair")
end)
end
if script.Parent.HairButtonUp.Number.Value == 2 then
script.Parent.HairButtonDown.MouseButton1Click:Connect(function()
remote2:FireServer("ChangeHair")
end)
end
if script.Parent.HairButtonUp.Number.Value == 3 then
script.Parent.HairButtonDown.MouseButton1Click:Connect(function()
remote3:FireServer("ChangeHair")
end)
end
if script.Parent.HairButtonUp.Number.Value == 4 then
script.Parent.HairButtonDown.MouseButton1Click:Connect(function()
remote4:FireServer("ChangeHair")
end)
end
if script.Parent.HairButtonUp.Number.Value == 5 then
script.Parent.HairButtonDown.MouseButton1Click:Connect(function()
remote5:FireServer("ChangeHair")
end)
end
if script.Parent.HairButtonUp.Number.Value == 6 then
script.Parent.HairButtonDown.MouseButton1Click:Connect(function()
remote6:FireServer("ChangeHair")
end)
end
Server Script:
local remote1 = game:GetService("ReplicatedStorage").Hair1
remote1.OnServerEvent:Connect(function(Player, task)
local dummy = workspace.customizegui.l
if task == "ChangeHair" then
if dummy:FindFirstChild("Hair") then
dummy:FindFirstChild("Hair")
end
local x = script.Parent.Hair.Hair1:Clone()
x.Name = "Hair"
end
end)
local remote2 = game:GetService("ReplicatedStorage").Hair2
remote2.OnServerEvent:Connect(function(Player, task)
local dummy = workspace.customizegui.l
if task == "ChangeHair" then
if dummy:FindFirstChild("Hair") then
dummy:FindFirstChild("Hair")
end
local x = script.Parent.Hair.Hair2:Clone()
x.Name = "Hair"
end
end)
local remote3 = game:GetService("ReplicatedStorage").Hair3
remote3.OnServerEvent:Connect(function(Player, task)
local dummy = workspace.customizegui.l
if task == "ChangeHair" then
if dummy:FindFirstChild("Hair") then
dummy:FindFirstChild("Hair")
end
local x = script.Parent.Hair.Hair3:Clone()
x.Name = "Hair"
end
end)
local remote4 = game:GetService("ReplicatedStorage").Hair4
remote4.OnServerEvent:Connect(function(Player, task)
local dummy = workspace.customizegui.l
if task == "ChangeHair" then
if dummy:FindFirstChild("Hair") then
dummy:FindFirstChild("Hair")
end
local x = script.Parent.Hair.Hair4:Clone()
x.Name = "Hair"
end
end)
local remote5 = game:GetService("ReplicatedStorage").Hair5
remote5.OnServerEvent:Connect(function(Player, task)
local dummy = workspace.customizegui.l
if task == "ChangeHair" then
if dummy:FindFirstChild("Hair") then
dummy:FindFirstChild("Hair")
end
local x = script.Parent.Hair.Hair5:Clone()
x.Name = "Hair"
end
end)
local remote6 = game:GetService("ReplicatedStorage").Hair6
remote6.OnServerEvent:Connect(function(Player, task)
local dummy = workspace.customizegui.l
if task == "ChangeHair" then
if dummy:FindFirstChild("Hair") then
dummy:FindFirstChild("Hair")
end
local x = script.Parent.Hair.Hair6:Clone()
x.Name = "Hair"
end
end)