Hi, I have a problem. In this local script:
local player = game.Players.LocalPlayer
wait(5)
local name = "Brumb"
print(name)
script.Parent.MouseButton1Click:Connect(function()
game.ReplicatedStorage.BuyItem:FireServer(player, name)
end)
It prints "Brumb". But in script in ServerScriptService:
game.ReplicatedStorage.BuyItem.OnServerEvent:Connect(function(player, name)
wait(0.1)
print(name)
local cost = player.PlayerGui.MainMenu.Shop.Characters.CharactersFrame:FindFirstChild(name).Cost.Value
if player.Coins.Value == cost or player.Coins.Value > cost then
print("Can buy "..name)
else
print("Can't buy "..name)
end
end)
It prints my username as name. Why is it happening?

1 comment
Try where it says // game.ReplicatedStorage.BuyItem:FireServer(player, name) \ to remove player, in the client its auto sent. So the code under is fine. But the top one, Remove player, name.