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()
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)