I had a quick question while working on my scripting world today. How would you find out what player clicked a button in a situation like shown below?
Okay, so I have a textButton with the following script as a localscript:
script.Parent.MouseButton1Click:Connect(function() game.ReplicatedStorage.RemoteEvent:FireServer(5647630275) end)
And then I of course had the RemoteEvent named “RemoteEvent”
And then I had this script called “PlayAnimScript” that plays the animation, which had the following script:
local AnimPlaying = false game.ReplicatedStorage.RemoteEvent.OnServerEvent:Connect(function(player,animationID) local animation = Instance.new("Animation") animation.AnimationId = "http://www.roblox.com/Asset?ID="..animationID if AnimPlaying == false then local loadedAnimation = game.Workspace[player.Name].Humanoid:LoadAnimation(animation) loadedAnimation:Play() AnimPlaying=true wait(1) local headLifts = player.leaderstats.headLifts headLifts.Value = headLifts.Value+1 AnimPlaying=false end end)
And I was wondering how I would get this area to work:
local headLifts = player.leaderstats.headLifts headLifts.Value = headLifts.Value+1
How would I get the specific player who clicked the button in the first place?
All this script worked before adding the leaderstats area into the server script, which I’m just leaving in there for now because I know I’ll need it