So I’ve been trying to figure out how to carry the information from the server over to the client. (carry over a players userId)
Server Side
function gui(amount,userId)
local plr = game.Players:GetPlayerByUserId(userId)
game.StarterGui.Donations.Someone_Donated.Donate.TextButton.Text = (plr.Name…" Donated "…tostring(amount)) >>this is what i want the gui to say on the client side
remoteEvent:FireAllClients()
end
Client Side
local ReplicatedStorage = game:GetService(“ReplicatedStorage”)
local remoteEvent = ReplicatedStorage:WaitForChild(“Gui”)
local donated = script.Parent.parent.Parent
local function yes()
game.StarterGui.Donations.Someone_Donated.Donate.TextButton.Text = (plr.Name…"Donated "…tostring(amount))
donated:TweenPosition(UDim2.new(1, 0,0.908, 0), ‘Out’, ‘Sine’, ‘12’)
wait(12)
donated.Position = UDim2.new(-1, 0,0.908, 0)
script.Disabled = true
end
remoteEvent.OnClientEvent:Connect(yes)
If any could help me carry the players userId (a different player than the one receiving it) It would be much appreciated.
Please ask questions down below! ( I know it is pretty confusing.)
I believe you have 3 issues. First, you aren’t passing any information. To fix this problem, this line of code:
Would now become:
remoteEvent:FireAllClients(plr)
This will now pass the value of the plr variable, and the clients will be able to use it.
Next, to actually use it on the client, we would change the first lines to:
local function yes(plr)
game.StarterGui.Donations.Someone_Donated.Donate.TextButton.Text = (plr.."Donated "..tostring(amount))
The second issue is that you are modifying StarterGui from a LocalScript, as I can tell from this line:
The problem with this is that it would not change what the player is seeing, but only what they see on their next respawn. I’m not sure if this is intended, but if not, change that line to:
Finally, you give strings to :TweenPosition. I haven’t test if this would cause an error, but I’m pretty sure you’d have to use Enums and numbers instead. Change this: