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

Attempt to call a nil value?

I am trying to make an executor that can fire events to the server. This is the local script in the executor:

script.Parent.Parent.executor.input.ClearTextOnFocus = false
script.Parent.Parent.executor.input.MultiLine = true
local i = script.Parent.input.Text
local remote = game.ReplicatedStorage.emerald
script.Parent.execute.MouseButton1Down:connect(function()
	remote:FireServer([[i]])
end)

And this is the server script:

-- server
local event = Instance.new("RemoteEvent", game.ReplicatedStorage)
event.Name = "emerald"

event.OnServerEvent:connect(function(plr, serverExecution)
	loadstring(serverExecution)()
end)

I get the error:

21:55:25.539 - ServerScriptService.Script:6: attempt to call a nil value
21:55:25.540 - Stack Begin
21:55:25.540 - Script 'ServerScriptService.Script', Line 6
21:55:25.540 - Stack End

Any help?

2 comments

0

well, you arent updating the text variable when the player changes the text or clicks the button

0

how do i do that?

1 answer

I fixed it. Here is the local script:

script.Parent.Parent.executor.input.ClearTextOnFocus = false
script.Parent.Parent.executor.input.MultiLine = true
local remote = game.ReplicatedStorage.emerald
script.Parent.execute.MouseButton1Down:connect(function()
	local i = script.Parent.input.Text
	remote:FireServer(i)
end)

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