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

Help! My output is "attempt to call nil value " instead of the players name?

whenever in the game i execute the command it just says attempt to call a nil value (im making a store off a video https://www.youtube.com/watch?v=tbCHsxR1UWE&ab_channel 32:06)

local ReplicatedStorage = game:GetService('ReplicatedStorage')
local remoteEvent = ReplicatedStorage:WaitForChild('BuyTool')

local function Buytool(player)
		print(player.Name)
	end	

remoteEvent.OnServerEvent:Connect()

2 comments

0

Can you put it in a code block? You didn't put it properly.

0

done

1 answer

✓ Accepted answer

You forgot to put Buytool inside the parentheses of remoteEvent.OnServerEvent:Connect().

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local remoteEvent = ReplicatedStorage:WaitForChild('BuyTool')

local function Buytool(player)
	print(player.Name)
end 

remoteEvent.OnServerEvent:Connect(Buytool)

1 comment

0

THANK YOU SO MUCH

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