You can write your topic however you want, but you need to answer these questions:
What do you want to achieve? Keep it simple and clear!
Print the name of the button that fired a remote event
What is the issue? Include screenshots / videos if possible!
It prints username, instead of button name
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I tried moving around parameters and removing player from parameters etc
local function Vote(name)
local name = script.Parent.name
remoteEvent:FireServer(name)
end
-- Local ^^ Server Script VV
local voter = 0
local function VoteHandle(name)
voter = voter + 1
print(voter)
print(name)
end
--Handle remote event etc
local function Vote(name)
local name = script.Parent.name
remoteEvent:FireServer(name)
end
-- Local ^^ Server Script VV
local voter = 0
local function VoteHandle(name)
voter = voter + 1
print(voter)
print(name)
end
In this script, name is defined as the player.
Write it as this:
local function Vote(name)
local name = script.Parent.name
remoteEvent:FireServer(name)
end
-- Local ^^ Server Script VV
local voter = 0
local function VoteHandle(player, name)
voter = voter + 1
print(voter)
print(name)
end
Think of the first parameter of a RemoteEvent as it calling for the player who sent it.