Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Variables i'm sending to the server are calling to an error, help?

Asked by
nap516 87
4 years ago

Basically there is a function inside of a button. Said function is supposed to send the texture ID that is typed into a textbox to display on a decal. But for some reason i'm getting this error: Text is not a valid member of Player

Can someone please help?

Client

local textboxtext = script.Parent.Parent.TextBox

script.Parent.MouseButton1Click:Connect(function(textboxtext)
    game.ReplicatedStorage.LoadDecal:FireServer(textboxtext)
end)

Server

game.ReplicatedStorage.LoadDecal.OnServerEvent:Connect(function(textboxtext)
    game.Workspace.TVTron.Decal = "rbxassetid://"..textboxtext.Text
    print("event fired!")
end)

1 answer

Log in to vote
1
Answered by 4 years ago
Edited 4 years ago

Broken client:

local textboxtext = script.Parent.Parent.TextBox

script.Parent.MouseButton1Click:Connect(function(textboxtext)
    game.ReplicatedStorage.LoadDecal:FireServer(textboxtext)--Doesn't work because GUI's in StarterGui don't load in for the server.
end)

Fixed client:

local textboxtext = script.Parent.Parent.TextBox

script.Parent.MouseButton1Click:Connect(function()
    game.ReplicatedStorage.LoadDecal:FireServer(textboxtext.Text)--Sends the text instead of TextBox, this way the server can actually read it.
end)

Fixed server:

game.ReplicatedStorage.LoadDecal.OnServerEvent:Connect(function(player, textboxtext)
    game.Workspace.TVTron.Decal = "rbxassetid://"..textboxtext
    print("event fired!")
end)
0
Not fully working but I was able to edit all of the remaining errors and make it work. I forgot to make add the texture property after decal as well as remove the textboxtext from the function in the client. nap516 87 — 4y
0
I hope I helped you! firestarroblox123 440 — 4y
Ad

Answer this question