Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

bad argument #3 to 'Value' (string expected, got Object)? [Fixed]

Asked by 6 years ago
Edited 6 years ago

i was coding my new game and i got a Error: 19:11:40.756 - ServerScriptService.events.stashon:3: bad argument #3 to 'Value' (string expected, got Object)

on line 3 of this code

local Plr_name = script.Parent.Parent.Parent.Parent.Parent.Parent.Name
script.Parent.MouseButton1Click:Connect(function()
    script.Parent.Parent.Parent.Visible = false
    game.ReplicatedStorage.stashon:InvokeServer(Plr_name)
end)

this is the Server script

function give_stshon(Plr_name)
    if game.ServerScriptService.ONrs.s_1.Value == "" then
        game.ServerScriptService.ONrs.s_1.Value = Plr_name
        return 1
    end
    if game.ServerScriptService.ONrs.s_2.Value == "" then
        game.ServerScriptService.ONrs.s_2.Value = Plr_name
        return 2
    end
    if game.ServerScriptService.ONrs.s_3.Value == "" then
        game.ServerScriptService.ONrs.s_3.Value = Plr_name
        return 3
    end
    if game.ServerScriptService.ONrs.s_4.Value == "" then
        game.ServerScriptService.ONrs.s_4.Value = Plr_name
        return 4
    end
    if game.ServerScriptService.ONrs.s_5.Value == "" then
        game.ServerScriptService.ONrs.s_5.Value = Plr_name
        return 5
    end
    if game.ServerScriptService.ONrs.s_6.Value == "" then
        game.ServerScriptService.ONrs.s_6.Value = Plr_name
        return 6
    end
end

game.ReplicatedStorage.stashon.OnServerInvoke = give_stshon
0
Cool but we don't even have that server script User#24403 69 — 6y
0
is this the whole script, because it doesn't look like it, PS, you dont need to send the Plr_name to the server because the server will automatically get the player who invoked the server on that remote function ScrubSadmir 200 — 6y
0
Include the server script code from server script service and i'll be glad to help; Warfaresh0t 414 — 6y

1 answer

Log in to vote
0
Answered by
Narunzo 172
6 years ago
Edited 6 years ago

Change (Plr_name) after "InvokeServer" to () because by default Roblox sets the value to the player that clicked the Gui.

Ad

Answer this question