I'm trying to make a script where when a player clicks on another player they can sell an item. I've got 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)
local mousetarget = Mouse.Target.Parent
game.ReplicatedStorage.SellPistol:FireServer(mousetarget)
end
end)
Then I have this script under ServerScriptService:
local SellPistol = game.ReplicatedStorage.SellPistol
local function onSellPistol(player, mousetarget)
mousetarget.StarterGui.StartScreen.Frame.Visible = true
print("Debug")
end
SellPistol.OnServerEvent:Connect(onSellPistol)
When i click on another player I get this:
StarterGui is not a valid member of model
Did I use the parameter wrong?

1 comment
mayb if ur good at scripting u wldnt have to ask this questions