In the Server Script below I'm trying to clone a Billboard GUI that will be above the player's read and show the result of a math.random which is the result of a dice roll, I am cloning the Billboard GUI and parenting it to the player so it is shown above their head, the problem is that I'm using a RemoteEvent to send two datas, the player and the rollnumber which is the result, everything works until that line "DiceResult.TextLabel.Text = rollnumber.Text" where it says: Text is not a valid member of Player, could someone help me with that? I know that probably there is an easy fix to that but it is a problem so specific that I couldn't find others similar so I had to ask here, I appreciate the help.
Local Script activated through a button:
local ReplicatedStorage = game:GetService("ReplicatedStorage") local DiceRoll = ReplicatedStorage.DiceRoll local player = game:GetService("Players").LocalPlayer numbers = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20} roll = script.Parent.Window.Roll rollnumber = script.Parent.Window.Number enabled = true roll.MouseButton1Down:connect(function() if enabled == true then rollnumber.Text = math.random(1,#numbers) script.Parent.Sound:Play() enabled = false DiceRoll:FireServer(player, rollnumber) wait(10) enabled = true end end)
Server Script activated through the RemoteEvent:
local ReplicatedStorage = game:GetService("ReplicatedStorage") local ServerStorage = game:GetService("ServerStorage") local DiceRoll = ReplicatedStorage.DiceRoll local Namer = ServerStorage.Namer local function RollADice(player, rollnumber) local DiceResult = Namer:Clone() DiceResult.Name = "DiceResult" DiceResult.Parent = player.Character.Head DiceResult.TextLabel.Text = rollnumber.Text wait(10) DiceResult:Destroy() end DiceRoll.OnServerEvent:Connect(RollADice)
What I'm guessing is you're firing the event like this: :FireServer(Player, rollnumber)
. If I am right then you should be firing the server like this: :FireServer(rollnumber)
because the server automatically gets the player so you don't have to input that parameter. If I am wrong please tell me and we can further debug.
EDIT: With full scripts
Try this:
Local Script - Line 15: DiceRoll:FireServer(rollnumber)
EDIT 2: Server Script
Line 10: DiceResult.TextLabel.Text = rollnumber
EDIT 3: Local Script
DiceRoll:FireServer(rollnumber.Text)
The error is because of the last line in your script, OnServerEvent returns the player as the first argument, so you have essentially stored the player in the RollADice variable, change the final line to:
DiceRoll.OnServerEvent:Connect(player, RollADice)
Hope this helps.
EDIT: You also don't need the "player" in the FireServer() bit, that is already returned to the server in the first argument when you use OnServerEvent.