Hey, I have another silly question, I have a function that changes values server sided but for some example it does it the wrong way
This is the local script:
local bidValue = ReplicatedStorage:WaitForChild("HighestBid")
local bid = localBid
local bidder = player.Name
remoteEvent:FireServer(bid, bidder)
This is the server script:
local bidValue = ReplicatedStorage:WaitForChild("HighestBid")
local bidderValue = ReplicatedStorage:WaitForChild("HighestBidder")
local function changeValues(bid, bidder)
bidValue.Value = bid
bidderValue.Value = bidder
highestBid.Text = tostring(bid)
highestBidder.Text = bidder
end
But this is what it gives me:
HighestBidder is meant to be a name, and highestbid is meant to be the 124
It is probably another stupid mistake I made but I can not seem to find it, does anyone know why this happens??
When you fire the server with your remoteEvent, bid gets assigned the player who fired the event and bidder is assigned the bid. In short, thatâs why it reverses.
If you need to keep both of those arguments and the player argument canât replace bidder, do
remoteEvent:FireServer(bidder, bid)
Otherwise if the player argument IS the bidder you wanted anyways, you can just simply do remoteEvent:FireServer(bid)
The bidder will automatically be the first argument of your listening function on the server side.
I just changed remoteEvent:FireServer(bid, bidder) to remoteEvent:FireServer(bidder, bid) and also changed it for the function to (bidder, bid) but now it doesnât change the bid value, the bid value stays at 0, but it does change the bidder name to the player name
Also in the Bindable Events and Functions | Roblox Creator Documentation page it does not say anything about of the arguments work like the way you said it, it gives an example of, remoteEvent:FireServer(BrickColor.Red(), Vector3.new(0, 25, 0))
Also yes it does define it that way, please refer to RemoteEvent.OnServerEvent. I worded it differently but the first argument is always the firing player.
When I print the bid value in the local script, it prints the value that I put in but in the server script it prints out my username and does not change the value
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local remoteEvent = ReplicatedStorage:WaitForChild("AuctionBidEvent")
local gui = script.Parent
local highestBid = script.Parent.MainFrame.BidFrame.BidAmount
local highestBidder = script.Parent.MainFrame.BidFrame.BidName
local bidValue = ReplicatedStorage:WaitForChild("HighestBid")
local bidderValue = ReplicatedStorage:WaitForChild("HighestBidder")
local function changeValues(bidder, bid)
bidValue.Value = bid
bidderValue.Value = tostring(bidder)
highestBid.Text = tostring(bid)
highestBidder.Text = tostring(bidder)
end
remoteEvent.OnServerEvent:Connect(changeValues)