I have a script that when you click a proximity prompt, It makes a GUI show the name of the prompt. But for some reason, When I test and use it, It just sayings “Nil”
This is my script
Server
script.Parent.Triggered:Connect(function(player)
if player then
local name = script.Parent.Parent.Parent.Name
game.ReplicatedStorage.Events.Painting:InvokeClient(player, name)
return true
else
return false
end
end)
To expand on what has been said by @Winbloo above.
When you use :InvokeClient() two arguments exist:
Player - The player you wish to send the data too.
…: data - Which can be any amount of data.
The first argument is only used by the server to know who to send the data too, the client already knows who they are (game.Players.LocalPlayer) and so this is unnecessary information. As such the argument is not passed over.
I would suggest reading the documentation provided by Roblox for more information about how things work as its all outline here (its also a life skill for coding to be honest):
As shown under the “arguments” section, it says that it only sends the parameters sent through.