Text is not a valid member of Player?
Asked by
4 years ago Edited 4 years ago
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:
01 | local ReplicatedStorage = game:GetService( "ReplicatedStorage" ) |
02 | local DiceRoll = ReplicatedStorage.DiceRoll |
04 | local player = game:GetService( "Players" ).LocalPlayer |
06 | numbers = { 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 , 13 , 14 , 15 , 16 , 17 , 18 , 19 , 20 } |
07 | roll = script.Parent.Window.Roll |
08 | rollnumber = script.Parent.Window.Number |
10 | roll.MouseButton 1 Down:connect( function () |
11 | if enabled = = true then |
12 | rollnumber.Text = math.random( 1 ,#numbers) |
13 | script.Parent.Sound:Play() |
15 | DiceRoll:FireServer(player, rollnumber) |
Server Script activated through the RemoteEvent:
01 | local ReplicatedStorage = game:GetService( "ReplicatedStorage" ) |
02 | local ServerStorage = game:GetService( "ServerStorage" ) |
03 | local DiceRoll = ReplicatedStorage.DiceRoll |
04 | local Namer = ServerStorage.Namer |
06 | local function RollADice(player, rollnumber) |
07 | local DiceResult = Namer:Clone() |
08 | DiceResult.Name = "DiceResult" |
09 | DiceResult.Parent = player.Character.Head |
10 | DiceResult.TextLabel.Text = rollnumber.Text |
15 | DiceRoll.OnServerEvent:Connect(RollADice) |