what do i want to achieve? im simply making a character creation screen and im working on the class selection part, so when they player clicks the text button of named class, it fires a remote sending along with it the name of the text button, which is also the class name to the server so that it can set the value of their class, then i fire the remote from the server to the client sending the same value i sent to server, but one of my if statements isnt passing for some reason which is line 71 on the client script
Client Code: – placed in the starter pack
local plr = game.Players.LocalPlayer
local char = plr.Character
local remotes = game.ReplicatedStorage:WaitForChild("Remotes",15)
local tweenService = game:GetService("TweenService")
local tinfo = TweenInfo.new(.5)
local twinfo = TweenInfo.new(1.5)
local plrGui = plr:WaitForChild("PlayerGui")
local HUD = plrGui:WaitForChild("HUD")
local classInfo = HUD:WaitForChild("ClassInformation")
local classSelection = HUD:WaitForChild("ClassSelection")
local classFrame = classInfo.AdvancedClasses.ValueFrame
local classTable = {
"Soldier";
"Priest";
"Magician";
"Rogue";
"Spearman";
"Deathwalker";
}
local cam = workspace.CurrentCamera
--local subject = workspace.camMove
for i,v in pairs(classSelection:GetChildren()) do
if not v:IsA("TextButton") then continue end
v.MouseEnter:Connect(function()
if v:IsA("TextButton") then
if v.Diamond:FindFirstChild("Unlocked") then
local newTween = tweenService:Create(v,tinfo,{Size = UDim2.new(0.15,0,0.25,0)},true)
local newTween2 = tweenService:Create(v.Diamond.Unlocked,tinfo,{Size = UDim2.new(.95,0,.95,0)},true)
local newTween3 = tweenService:Create(v.Diamond.Unlocked,tinfo,{Position = UDim2.new(0.05,0,0.05,0)},true)
newTween:Play()
newTween2:Play()
newTween3:Play()
end
end
end)
v.MouseLeave:Connect(function()
if v:IsA("TextButton") then
if v.Diamond:FindFirstChild("Unlocked") then
local newTween = tweenService:Create(v,tinfo,{Size = UDim2.new(0.111,0,0.18,0)})
local newTween2 = tweenService:Create(v.Diamond.Unlocked,tinfo,{Size = UDim2.new(.5,0,.5,0)},true)
local newTween3 = tweenService:Create(v.Diamond.Unlocked,tinfo,{Position = UDim2.new(0.25,0,0.25,0)},true)
newTween:Play()
newTween2:Play()
newTween3:Play()
end
end
end)
v.MouseButton1Click:Connect(function()
remotes.class.FireServer(remotes.class,v.Name)
end)
end
remotes.contact.OnClientEvent:Connect(function(player,value)
print("signal recieved")
if value ~= classTable[value] then return end
print("if statement passed line 69")
if value == "Soldier" then
print("if statement passed line 71")
local tweenCam = tweenService:Create(cam,twinfo,{CoordinateFrame = workspace.KnightCam.CFrame * CFrame.new(0,0,0)},true)
tweenCam:Play()
classFrame.ClassOne.Text = "Paladin"
classFrame.ClassTwo.Text = "Knight"
elseif value == "Priest" then
local tweenCam = tweenService:Create(cam,twinfo,{CoordinateFrame = workspace.PriestCam.CFrame * CFrame.new(0,0,0)},true)
tweenCam:Play()
classFrame.ClassOne.Text = "Holy Master"
classFrame.ClassTwo.Text = "Cleric"
end
end)
Server Code – in ServerScriptService
local remotes = game.ReplicatedStorage:WaitForChild("Remotes",15)
remotes.class.OnServerEvent:Connect(function(player,value)
local stats = player:WaitForChild("Stats")
local classStat = stats:WaitForChild("Class")
classStat.Value = value
remotes.contact:FireClient(player,value)
print("sent signal")
end)
if you can help, i appreciate it.