Hi I’m making a door code script with gui and in my previous post where Aanggoodluck solved the initial problem.
Now when I type in the correct code, it just says that the valued are not the same :
Code:
--local script
local KGUI = game.Players.LocalPlayer.PlayerGui.KeycodeGUI
local Chiffre = KGUI.Frame.Frame.CodeSee
local frame = script.Parent.Frame.Frame.Frame
game.ReplicatedStorage.EnableKGUI.OnClientEvent:Connect(function()
KGUI.Enabled = true
KGUI.Frame:TweenPosition(UDim2.new(0,0,0,0),"Out","Back",1,false)
end)
KGUI.Frame.X.MouseButton1Click:Connect(function()
KGUI.Enabled = false
end)
for i ,key in pairs(frame:GetChildren()) do
if string.find(key.Name, "Key") then
key.MouseButton1Click:Connect(function()
Chiffre.Text ..= string.match(key.Name, "%d")
end)
elseif key.Name == "Back" then
key.MouseButton1Click:Connect(function()
Chiffre.Text = string.sub(Chiffre.Text,1,0)
end)
elseif key.Name == "Enter" then
key.MouseButton1Click:Connect(function()
script.Parent.Done.Value = true
game.ReplicatedStorage.EnableKGUI:FireServer(script.Parent.Done.Value,Chiffre.Text)
end)
end
end
-- Server script
local remote = game.ReplicatedStorage.EnableKGUI
remote.OnServerEvent:Connect(function(player,complete,text)
local CodeValue = script.Parent.Parent.Parent.Parent.Parent.PC.Screen.Code
print(CodeValue.Value)
local GUI = player.PlayerGui.KeycodeGUI
GUI.Done.Value=complete
GUI.Frame.Frame.CodeSee.Text =text
if GUI.Done.Value == true then
print("User has given a code")
print(text)
if text==CodeValue.Value then -- This is where there's a problem
print("CORRECT")
else
print("INCORRECT")
end
end
end)
script.Parent.Prompt.Triggered:Connect(function(player)
game.ReplicatedStorage.EnableKGUI:FireClient(player)
end)
Remote location:
Game file ( i’m not very good at explaining so maybe this helps ) :game.rbxl (67.5 KB)
5986 = the random generated code
1234= code given
INCORRECT = either the code is correct or not
5986 = the random generated code
5986= code given
INCORRECT = either the code is correct or not ( it should be correct )