local function onLock()
if selectedTemplate ~= nil then
print(40)
local action = not selectedTemplate.Locked.Value
local result = ReplicatedStorage.Remotes.LockPet:FireServer(player,selectedTemplate.Name,true)
print(result)
if result == 2 then
selectedTemplate.Locked.Value = true
selectedTemplate:FindFirstChild("Lock").Visible = true
elseif result == 1 then
selectedTemplate.Locked.Value = false
selectedTemplate:FindFirstChild("Lock").Visible = false
end
end
end
on the print(result) line it keeps printing nil.
Here is the server side
remotes.LockPet.OnServerEvent:Connect(function(player,tempName,action)
for i, pet in pairs(player.OtherStats.Pets:GetChildren()) do
if pet:GetAttribute("UUID") == tempName then
pet:SetAttribute("Locked",action)
end
if pet:GetAttribute("Locked") == false then return 1 else return 2 end
end
end)