I have a local script which is firing a remote event but whenever i receive the remote event on the server side the server outputs all the clients as players who touched the object.
The code looks something like this:
local script
local sell = game.Workspace:WaitForChild("Sell").OpenShop.Sellpart
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local test = game.StarterGui.ScreenGui.TextButton
sell.Touched:Connect(function(hit)
if game.Players:GetPlayerFromCharacter(hit.Parent) then
local player = game.Players[hit.Parent.name]
ReplicatedStorage.Remotes.Sell:FireServer(player)
end
end)
Script
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local RemoteData = game:GetService("ServerStorage"):WaitForChild("RemoteData")
local sell = game.Workspace:WaitForChild("Sell").OpenShop.Sellpart
ReplicatedStorage.Remotes.Sell.OnServerEvent:Connect(function(player)
player.leaderstats.Coins.Value = player.leaderstats.Coins.Value + player.invisstats.Strength.Value
player.invisstats.Strength.Value = 0
player.PlayerGui:WaitForChild("Coins").Coinnumber.Text = (player.leaderstats.Coins.Value)
player.PlayerGui:WaitForChild("Coins").CoinShadow.Text = player.PlayerGui:WaitForChild("Coins").Coinnumber.Text
end)

1 comment
Didn't help my problem. When one player touches the part the server still thinks that all the players in the server has touched the part. For example if i added print between line 5 and 6 on the Script and printed player, the output would be everyone that's currently on the server. I only want the one who initially touched the part to be outputted.