Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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

3 comments

0

Cool but we don't even have that server script

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

0

Include the server script code from server script service and i'll be glad to help;

1 answer

✓ Accepted answer

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

This discussion is preserved as it was. New answers, comments, and votes are closed.