Problem with transfering text of textbox from localscript to a script

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    Send a webhook with text written in the textbox
  2. What is the issue? Include screenshots / videos if possible!
    I just cannot make it to work please help
  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    changing to remote event, didnt help or im just really bad at them.
  --localscript
	local RS = game:GetService("ReplicatedStorage")
	
	local user = game:GetService("Players").LocalPlayer
	
	local WLRequire = require(RS.WhitelistModuleScript)
	local Owners = WLRequire.Owners
	
	script.Parent.MouseButton1Click:Connect(function()
		if table.find(Owners, game.Players.LocalPlayer.Name) then
			RS:FindFirstChild("FireEvent"):FireServer(script.Parent.Parent.UsernameBox.Text,  script.Parent.Parent.UserIdBox.Text)
			script.Parent.Script:Destroy()
		else
			game.Players.LocalPlayer:Kick("Detected Exploits CODE: Firing RemoteEvent")
			script.Parent.Script:Destroy()
		end
	end)
   --server script
	RS:FindFirstChild("FireEvent").OnServerEvent:Connect(function(usernametext, useridtext)
		if script.Parent.Parent.addedButton.BackgroundColor3 == Color3.fromRGB(20, 20, 20) then
			local fields = {
				{
					['name'] = "User: "..usernametext.Text, <-- here problem
					['value'] = "UserId: "..useridtext.PlayerGui.MainMenuGUI.WhitelistFrame.UserIdBox.Text, <-- this doesnt work too, i tried it too
					['inline'] = false
				}
			}
			req.Title = "Added to whitelist"
			if script.Parent.Parent.F1reButton.BackgroundColor3 == Color3.fromRGB(10, 10, 10) then
				req.Description = "Admin that added: catkingsteam (ItzSzmaragd)"
			else
				req.Description = "Admin that added: sheluvs.ailly (kabanosjestfajny)"
			end
			
			req.Color = ws.colors.green
			req.Fields = fields
			req.Thumbnail = ""
			req.Footer = "Coded by F1re"
			req.FooterIcon = ""
			req:sendEmbed(url)
		else  -- theres more code then, but its not needed to add here.

OnServerEvent provides the player as first parameter by default, so you’re trying to index the player with .Text. Just define the parameter even if you’re not going to use it.

RS:FindFirstChild("FireEvent").OnServerEvent:Connect(function(player, usernametext, useridtext)
1 Like

attempt to concatenate string with Instance – this the error i get now

--localscript
RS:FindFirstChild("FireEvent"):FireServer(game.Players.LocalPlayer, script.Parent.Parent.UsernameBox.Text,  script.Parent.Parent.UserIdBox.Text)

--server script
RS:FindFirstChild("FireEvent").OnServerEvent:Connect(function(pl, usernametext, useridtext)
	if script.Parent.Parent.addedButton.BackgroundColor3 == Color3.fromRGB(20, 20, 20) then
		local fields = {
			{
				['name'] = "User: "..usernametext,
				['value'] = "UserId: "..useridtext,
				['inline'] = false
			}
		} ...

It means usernametext is an instance, probably the TextLabel, try to index it with .Text. If it doesn’t work check the arguments that you’re passing through the :FireServer() function.

1 Like

When I, do this it shows me error → Text is not a valid member of Player “Players.ItzSzmaragd”

['name'] = "User: "..usernametext.Text,
['value'] = "UserId: "..useridtext.Text,
---
RS:FindFirstChild("FireEvent"):FireServer(game.Players.LocalPlayer, script.Parent.Parent.UsernameBox,  script.Parent.Parent.UserIdBox)

it still doesnt work

I think you misunderstood what I said. You’re now passing the player instance as an argument too, so the parameters are looking like this: (player, player, usernametext, useridtext). You don’t need to pass the player, the event gets it by default.

1 Like

Hm, seems to do work because there are no errors but when it sends a discord webhook because thats what im trying to do, user: and userid: are blank i dont know why

Nevermind now, Thanks for helping me to get to my point Sarchyx!
(Fix: instead of this:)

RS:FindFirstChild("FireEvent"):FireServer(game.Players.LocalPlayer, script.Parent.Parent.UsernameBox,  script.Parent.Parent.UserIdBox)
--and this
['name'] = "User: "..usernametext.Text,
['value'] = "UserId: "..useridtext.Text,
--FIXED VERSION OF IT:
RS:FindFirstChild("FireEvent"):FireServer(game.Players.LocalPlayer, script.Parent.Parent.UsernameBox.Text,  script.Parent.Parent.UserIdBox.Text)
--and this
['name'] = "User: "..usernametext,
['value'] = "UserId: "..useridtext,

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.