How can I fix the "Invalid argument # 3?

My next script tries to detect 4 values ​​and those 4 values ​​must be sent to Localplayer in a folder and in that folder there will be another 4 stringValue, but it does not send the value to the values ​​of the localPlayer

local aceptar = script.Parent:WaitForChild("BAceptar")

local cancelar = script.Parent:WaitForChild("CCancelar")

local Abrir = script.Parent.Parent:WaitForChild("Abrir")

local Interactuar = script.Parent.Parent:WaitForChild("Interactuar")

local Agacharse = script.Parent.Parent:WaitForChild("Agacharse")

local Emotes = script.Parent.Parent:WaitForChild("Emotes")

local Main = game.Players.LocalPlayer.Keys

script.Parent.Parent.Abrir:GetPropertyChangedSignal("Value"):Connect(function()

Abrir = script.Parent.Parent.Abrir.Value

end)

script.Parent.Parent.Interactuar:GetPropertyChangedSignal("Value"):Connect(function()

Interactuar = script.Parent.Parent.Interactuar.Value

end)

script.Parent.Parent.Agacharse:GetPropertyChangedSignal("Value"):Connect(function()

Agacharse = script.Parent.Parent.Agacharse.Value

end)

script.Parent.Parent.Emotes:GetPropertyChangedSignal("Value"):Connect(function()

Emotes = script.Parent.Parent.Emotes.Value

end)

aceptar.MouseButton1Click:Connect(function()

local MainAbrir = Main:WaitForChild("MenuKey")

MainAbrir.Value = Abrir

local MainInt = Main:WaitForChild("InteractiveKey")

MainInt.Value = Interactuar

local MainIag = Main:WaitForChild("AgacharseKey")

MainIag.Value = Agacharse

local MainEmo = Main:WaitForChild("EmotesKey")

MainEmo.Value = Emotes

end)

What is line 27? The error also says that it expects a string, so make sure you’re feeding it a string.

On line 26, create a nickname and locate where the nickname will be to find the stringValue, and on line 27 send the stringValue from Parent.Parent and send it to the nickname

Can we see the code? The nickname is most probably returning as an Instance not string

try this

local strin = tostring(yourstringhere) --send this instead of what you're sending at the moment

You made two different posts and they each have a different line #27. What exactly is line 27? Are you sure that this is the script erroring?

Do I leave the file or explain to me? Right now I am really confused

the thing is you’re not sending a string instead you’re sending a value or instance thinking its a string. to fix this you can easily use “tostring()” function which converts whatever is inside to a string to fix the problem.

In this way?

local aceptar = script.Parent:WaitForChild("BAceptar")
    local Abrir = script.Parent.Parent:WaitForChild("Abrir")
    local Main = game.Players.LocalPlayer.Keys
    local LocalAbrir = Main:WaitForChild("MenuKey")

    script.Parent.Parent.Abrir:GetPropertyChangedSignal("Value"):Connect(function()
    Abrir = script.Parent.Parent.Abrir.Value
    end)


    aceptar.MouseButton1Click:Connect(function()
    local MainAbrir = tostring(LocalAbrir)
    MainAbrir.Value = Abrir
    end)

can you send the original script too so i can visualize what you are trying to do

2 Likes

ok

local aceptar = script.Parent:WaitForChild("BAceptar")
local cancelar = script.Parent:WaitForChild("CCancelar")
local Abrir = script.Parent.Parent:WaitForChild("Abrir")
local Interactuar = script.Parent.Parent:WaitForChild("Interactuar")
local Agacharse = script.Parent.Parent:WaitForChild("Agacharse")
local Emotes = script.Parent.Parent:WaitForChild("Emoteschange")
local Main = game.Players.LocalPlayer.Keys

script.Parent.Parent.Abrir:GetPropertyChangedSignal("Value"):Connect(function()
Abrir = script.Parent.Parent.Abrir.Value
end)

script.Parent.Parent.Interactuar:GetPropertyChangedSignal("Value"):Connect(function()
Interactuar = script.Parent.Parent.Interactuar.Value
end)

script.Parent.Parent.Agacharse:GetPropertyChangedSignal("Value"):Connect(function()
Agacharse = script.Parent.Parent.Agacharse.Value
end)

script.Parent.Parent.Emoteschange:GetPropertyChangedSignal("Value"):Connect(function()
Emotes = script.Parent.Parent.Emoteschange.Value
end)

aceptar.MouseButton1Click:Connect(function()
local MainAbrir = Main:WaitForChild("MenuKey")
MainAbrir.Value = Abrir
local MainInt = Main:WaitForChild("InteractiveKey")
MainInt.Value = Interactuar
local MainAgach = Main:WaitForChild("AgacharseKey")
MainAgach.Value = Agacharse
local MainEmotes = Main:WaitForChild("EmotesKey")
MainEmotes.Value = Emotes
end)

I try that the following values ​​of these string Values

Comisaria - Roblox Studio 30_03_2021 10_46_15 p. m. (2)_LI

They move to these values ​​to use as KeyBoard

Comisaria - Roblox Studio 30_03_2021 10_45_48 p. m. (2)

you are changing the wrong variable when you’re trying to update

updated code:

local aceptar = script.Parent:WaitForChild("BAceptar")
local cancelar = script.Parent:WaitForChild("CCancelar")
local Abrir = script.Parent.Parent:WaitForChild("Abrir")
local Interactuar = script.Parent.Parent:WaitForChild("Interactuar")
local Agacharse = script.Parent.Parent:WaitForChild("Agacharse")
local Emotes = script.Parent.Parent:WaitForChild("Emoteschange")
local Main = game.Players.LocalPlayer.Keys
local AbrirVal
local InteractuarVal
local AgacharseVal
local EmotesVal

AbrirVal = script.Parent.Parent.Abrir.Value
script.Parent.Parent.Abrir:GetPropertyChangedSignal("Value"):Connect(function()
    AbrirVal = script.Parent.Parent.Abrir.Value
end)

InteractuarVal = script.Parent.Parent.Interactuar.Value
script.Parent.Parent.Interactuar:GetPropertyChangedSignal("Value"):Connect(function()
    InteractuarVal = script.Parent.Parent.Interactuar.Value
end)

AgacharseVal = script.Parent.Parent.Agacharse.Value
script.Parent.Parent.Agacharse:GetPropertyChangedSignal("Value"):Connect(function()
    AgacharseVal = script.Parent.Parent.Agacharse.Value
end)

EmotesVal = script.Parent.Parent.Emoteschange.Value
  script.Parent.Parent.Emoteschange:GetPropertyChangedSignal("Value"):Connect(function()
        EmotesVal = script.Parent.Parent.Emoteschange.Value
    end)

aceptar.MouseButton1Click:Connect(function()

local MainAbrir = Main:WaitForChild("MenuKey")

MainAbrir.Value = AbrirVal

local MainInt = Main:WaitForChild("InteractiveKey")

MainInt.Value = InteractuarVal

local MainAgach = Main:WaitForChild("AgacharseKey")

MainAgach.Value = AgacharseVal

local MainEmotes = Main:WaitForChild("EmotesKey")

MainEmotes.Value = EmotesVal

end)
1 Like