I'm making a sell to player gui and I have this as a local script under StarterPlayerScripts
local Player = game.Players.LocalPlayer -- Getting the player
local Mouse = Player:GetMouse() -- Getting the players mouse
Mouse.Button1Down:Connect(function() -- Detecting when player presses the left mouse button
if Mouse.Target.Parent:FindFirstChild("Humanoid") and
game.Players.LocalPlayer.TeamColor.Name == ("Dirt brown") then -- Checking if the Mouse is over a player
print(Mouse.Target.Parent.Name)
game.ReplicatedStorage.SellPistol:FireServer(Mouse.Target)
end
end)
I also have this being connected to in a script under ServerScriptService
local SellPistol = game.ReplicatedStorage.SellPistol
local function onSellPistol(Mouse.Target)
Mouse.Target.StarterGui.StartScreen.Frame = Visible
end
SellPistol.OnServerEvent:Connect(onSellPistol)
How can I bring the (Mouse.Target) into the script using the FireServer from the RemoteEvent?

1 comment
You can simply pass it as a parameter as you would to anything else.