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

Attempting to call a nil value?

Hi. I am trying to make a script, which changes coins for other players.

The amount of Coins is getting put into a TextBox.

Now, I am getting an error which says "attempting to call a nil value"

I have no clue why, checked the scripts multiple times.

LocalScript:

local event = game.ReplicatedStorage.CoinChange

script.Parent.MouseButton1Click:Connect(function()
	 print(script.Parent.Parent.CoinsAmount.Text)
	event:FireServer()
	end)

Script:


local event = game.ReplicatedStorage.CoinChange

local function CoinChange()
	print("Works!")
end
 
event.OnServerEvent:Connect(CoinChange())


Do I oversee something?

2 comments

0

if this is a money gui, u totally dont need a remote event, just make it change the text to the desired leaderstat

0

It is a GUI for admins to change others money. Thats why I have a RemoteEvent

1 answer

Okay, I found the answer. I did a few letters too much.

Before:

event.OnServerEvent:Connect(CoinChange())

Fixed:

event.OnServerEvent:Connect(CoinChange)

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