So, I am making a shop and that when you press the button in a gui, it sends a remote event to a server with the player, the character, and the weapon the player wants to buy. However, in the local script, weapon = GoldSword which is what I want it to but when it goes to the server script it equals the player. Why is this?
The localscript
local plr = game.Players.LocalPlayer
local char = plr.Character
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Purchase = ReplicatedStorage:WaitForChild("PurchaseWeapon")
local Weapon = script.Parent.Tool.Value
function leftClick()
print(Weapon)
game.ReplicatedStorage:FindFirstChild("PurchaseWeapon"):FireServer(char, plr, Weapon)
end
function onTouchTap()
game.ReplicatedStorage:FindFirstChild("PurchaseWeapon"):FireServer(char, plr, Weapon)
end
script.Parent.MouseButton1Click:Connect(leftClick)
script.Parent.TouchTap:Connect(onTouchTap)
Serverscript
game.ReplicatedStorage.PurchaseWeapon.OnServerEvent:Connect(function(plr,char,Weapon)
local Cost = Weapon.Price.Value
if Cost > plr.Gold.Value or plr.Backpack:FindFirstChild(Weapon) or char:FindFirstChild(Weapon) then
plr.Gold.Value = plr.Gold.Value
else
plr.Gold.Value = plr.Gold.Value - Cost
Weapon:Clone().Parent = plr.Backpack
end
end)

1 comment
https://scriptinghelpers.org/questions/126932/remoteevent-printing-the-players-name#115308 you don't need to pass the player arguments