After I press the button and print the info on the client, everything seems normal, but when I print the passed info on the server side, it only passes parent.Name
without LocalPLayer.Name
. I used a remote event
it may be because I used local player name but I don’t know how to pass player’s name a diff way
server side:
game.ReplicatedStorage.PlayerDrop.OnServerEvent:Connect(function(item, player)
local p = game.Players:FindFirstChild(player)
local i = p.Inventory:FindFirstChild(item)
local part = game.ReplicatedStorage.Materials:FindFirstChild(item):Clone()
part.Parent = game.Workspace
part.Position = p.Character.PrimaryPart.Position + Vector3.new(0,6,0)
i -= 1
end)
client side:
script.Parent.MouseButton1Click:Connect(function()
game.ReplicatedStorage.PlayerDrop:FireServer(script.Parent.Name, game.Players.LocalPlayer.Name)
end)
explorer: