Attempt to concatenate string with nil

You need to fix the else chains so that they’re all contained within the same chain.

this is in a serverscript so i suppose im checking on the server

if plr.PlayerGui.FlightRating.Main.Rating2.Star5_Service_Image_Full.Visible == true then
	return "5"
elseif plr.PlayerGui.FlightRating.Main.Rating2.Star5_Service_Image_Half.Visible == true then
	return "4.5"
elseif plr.PlayerGui.FlightRating.Main.Rating2.Star4_Service_Image_Full.Visible == true then
	return "4"
elseif plr.PlayerGui.FlightRating.Main.Rating2.Star4_Service_Image_Half.Visible == true then
	return "3.5"
--and the rest follow

Here’s what I mean by that.

1 Like

The server cannot see client side changes made to the gui so I presume that it sees the default rating which is none visible.

You need to send maximum star rating that the player has to the server or figure out another way.

How would I do this tho? Like i tried it before but didnt succeed

I fixed else chains but now its the ui changes thing

you would basically do the same thing you are doing in this serverevent but move all functions to the client where you fire to the server, you then pass the associated ratings as parameters

(you would also need to make reasonable checks on server, you dont want someone to put rating = “100”)

local function rating1()
	if Rating1.Star5_Service_Image_Full.Visible == true then
		return "5"
	elseif Rating1.Star5_Service_Image_Half.Visible == true then
		return "4.5"
	elseif Rating1.Star4_Service_Image_Full.Visible == true then
		return "4"
	elseif Rating1.Star4_Service_Image_Half.Visible == true then
		return "3.5"
	elseif Rating1.Star3_Service_Image_Full.Visible == true then
		return "3"
	elseif Rating1.Star3_Service_Image_Half.Visible == true then
		return "2.5"
	elseif Rating1.Star2_Service_Image_Full.Visible == true then
		return "2"
	elseif Rating1.Star2_Service_Image_Half.Visible == true then
		return "1.5"
	elseif Rating1.Star1_Service_Image_Full.Visible == true then
		return "1"
	elseif Rating1.Star1_Service_Image_Half.Visible == true then
		return "0.5"
	end
	return "0"
end

Main.SendBtn.MouseButton1Click:Connect(function(rating1)
	rating1 = rating1()
	game.ReplicatedStorage.FlightRating.RE.Main:FireServer(rating1)
end)

This is what im doing on the client? doesnt seem to work

Rating1 is a folder inside the ui and i’ve called it with a local

you need to provide serverscript changes as well as you are doing it correctly right now at least in this local script hold up you forgot the else at the bottom of the elseif block
elseif Rating1.Star1_Service_Image_Half.Visible == true then
return “0.5”
else
return “0”

ReplicatedStorage.FlightRating.RE.Main.OnServerEvent:Connect(function(plr, rating1)
	
	local data = {
		['embeds'] = {{
			['title'] = "New Rating from "..plr.Name,
			['description'] = "Service: "..rating1,
			['color'] = 3769131,
			['url'] = "https://www.roblox.com/users/"..plr.UserId.."/profile",
			['fields'] = {
				['name'] = "Feedback:",
				['value'] = plr.PlayerGui.FlightRating.Main.FeedbackBox.Text
			}
			
		}}
	}
	
	local finaldata = http:JSONEncode(data)
	http:PostAsync(url, finaldata)
end)```

try adding prints for rating1 so we can see whats up also make sure to add the else return “0” i mentioned

Players.AviaTeamm.PlayerGui.FlightRating.ClientSideCore:443: attempt to call a nil value

Line 443 =

rating1 = rating1()

okay so I noticed you have 3 variables with the same name Rating1 and rating1 and function rating1, do you think you can change them, it could be messing up everything

In the future try to declare variables with more unique names so you don’t replace existing variables

done, what now? omg roblox let me post

show me local script code so i can see changes

it prints my correct value but says a bad request from HTTP 400 (Bad Request)

Fr_Loader’, Line 29

local gui = script.Parent
local Main = gui.Main


-- ID's: Empty: 8528934593 | Half: 8528935468 | Full: 8528936413

local Rating1 = Main.Rating1

Rating1.Star1_Service_Half.MouseButton1Click:Connect(function()
	Rating1.Star1_Service_Image_Half.Visible = true
	Rating1.Star2_Service_Image_Half.Visible = false
	Rating1.Star3_Service_Image_Half.Visible = false
	Rating1.Star4_Service_Image_Half.Visible = false
	Rating1.Star5_Service_Image_Half.Visible = false
	Rating1.Star1_Service_Image_Full.Visible = false
	Rating1.Star2_Service_Image_Full.Visible = false
	Rating1.Star3_Service_Image_Full.Visible = false
	Rating1.Star4_Service_Image_Full.Visible = false
	Rating1.Star5_Service_Image_Full.Visible = false
end)

Rating1.Star1_Service_Full.MouseButton1Click:Connect(function()
	Rating1.Star1_Service_Image_Half.Visible = false
	Rating1.Star2_Service_Image_Half.Visible = false
	Rating1.Star3_Service_Image_Half.Visible = false
	Rating1.Star4_Service_Image_Half.Visible = false
	Rating1.Star5_Service_Image_Half.Visible = false
	Rating1.Star1_Service_Image_Full.Visible = true
	Rating1.Star2_Service_Image_Full.Visible = false
	Rating1.Star3_Service_Image_Full.Visible = false
	Rating1.Star4_Service_Image_Full.Visible = false
	Rating1.Star5_Service_Image_Full.Visible = false
end)

Rating1.Star2_Service_Half.MouseButton1Click:Connect(function()
	Rating1.Star1_Service_Image_Half.Visible = false
	Rating1.Star2_Service_Image_Half.Visible = true
	Rating1.Star3_Service_Image_Half.Visible = false
	Rating1.Star4_Service_Image_Half.Visible = false
	Rating1.Star5_Service_Image_Half.Visible = false
	Rating1.Star1_Service_Image_Full.Visible = true
	Rating1.Star2_Service_Image_Full.Visible = false
	Rating1.Star3_Service_Image_Full.Visible = false
	Rating1.Star4_Service_Image_Full.Visible = false
	Rating1.Star5_Service_Image_Full.Visible = false
end)

Rating1.Star2_Service_Full.MouseButton1Click:Connect(function()
	Rating1.Star1_Service_Image_Half.Visible = false
	Rating1.Star2_Service_Image_Half.Visible = false
	Rating1.Star3_Service_Image_Half.Visible = false
	Rating1.Star4_Service_Image_Half.Visible = false
	Rating1.Star5_Service_Image_Half.Visible = false
	Rating1.Star1_Service_Image_Full.Visible = true
	Rating1.Star2_Service_Image_Full.Visible = true
	Rating1.Star3_Service_Image_Full.Visible = false
	Rating1.Star4_Service_Image_Full.Visible = false
	Rating1.Star5_Service_Image_Full.Visible = false
end)

Rating1.Star3_Service_Half.MouseButton1Click:Connect(function()
	Rating1.Star1_Service_Image_Half.Visible = false
	Rating1.Star2_Service_Image_Half.Visible = false
	Rating1.Star3_Service_Image_Half.Visible = true
	Rating1.Star4_Service_Image_Half.Visible = false
	Rating1.Star5_Service_Image_Half.Visible = false
	Rating1.Star1_Service_Image_Full.Visible = true
	Rating1.Star2_Service_Image_Full.Visible = true
	Rating1.Star3_Service_Image_Full.Visible = false
	Rating1.Star4_Service_Image_Full.Visible = false
	Rating1.Star5_Service_Image_Full.Visible = false
end)

Rating1.Star3_Service_Full.MouseButton1Click:Connect(function()
	Rating1.Star1_Service_Image_Half.Visible = false
	Rating1.Star2_Service_Image_Half.Visible = false
	Rating1.Star3_Service_Image_Half.Visible = false
	Rating1.Star4_Service_Image_Half.Visible = false
	Rating1.Star5_Service_Image_Half.Visible = false
	Rating1.Star1_Service_Image_Full.Visible = true
	Rating1.Star2_Service_Image_Full.Visible = true
	Rating1.Star3_Service_Image_Full.Visible = true
	Rating1.Star4_Service_Image_Full.Visible = false
	Rating1.Star5_Service_Image_Full.Visible = false
end)

Rating1.Star4_Service_Half.MouseButton1Click:Connect(function()
	Rating1.Star1_Service_Image_Half.Visible = false
	Rating1.Star2_Service_Image_Half.Visible = false
	Rating1.Star3_Service_Image_Half.Visible = false
	Rating1.Star4_Service_Image_Half.Visible = true
	Rating1.Star5_Service_Image_Half.Visible = false
	Rating1.Star1_Service_Image_Full.Visible = true
	Rating1.Star2_Service_Image_Full.Visible = true
	Rating1.Star3_Service_Image_Full.Visible = true
	Rating1.Star4_Service_Image_Full.Visible = false
	Rating1.Star5_Service_Image_Full.Visible = false
	
end)

Rating1.Star4_Service_Full.MouseButton1Click:Connect(function()
	Rating1.Star1_Service_Image_Half.Visible = false
	Rating1.Star2_Service_Image_Half.Visible = false
	Rating1.Star3_Service_Image_Half.Visible = false
	Rating1.Star4_Service_Image_Half.Visible = false
	Rating1.Star5_Service_Image_Half.Visible = false
	Rating1.Star1_Service_Image_Full.Visible = true
	Rating1.Star2_Service_Image_Full.Visible = true
	Rating1.Star3_Service_Image_Full.Visible = true
	Rating1.Star4_Service_Image_Full.Visible = true
	Rating1.Star5_Service_Image_Full.Visible = false
end)

Rating1.Star5_Service_Half.MouseButton1Click:Connect(function()
	Rating1.Star1_Service_Image_Half.Visible = false
	Rating1.Star2_Service_Image_Half.Visible = false
	Rating1.Star3_Service_Image_Half.Visible = false
	Rating1.Star4_Service_Image_Half.Visible = false
	Rating1.Star5_Service_Image_Half.Visible = true
	Rating1.Star1_Service_Image_Full.Visible = true
	Rating1.Star2_Service_Image_Full.Visible = true
	Rating1.Star3_Service_Image_Full.Visible = true
	Rating1.Star4_Service_Image_Full.Visible = true
	Rating1.Star5_Service_Image_Full.Visible = false

end)

Rating1.Star5_Service_Full.MouseButton1Click:Connect(function()
	Rating1.Star1_Service_Image_Half.Visible = false
	Rating1.Star2_Service_Image_Half.Visible = false
	Rating1.Star3_Service_Image_Half.Visible = false
	Rating1.Star4_Service_Image_Half.Visible = false
	Rating1.Star5_Service_Image_Half.Visible = false
	Rating1.Star1_Service_Image_Full.Visible = true
	Rating1.Star2_Service_Image_Full.Visible = true
	Rating1.Star3_Service_Image_Full.Visible = true
	Rating1.Star4_Service_Image_Full.Visible = true
	Rating1.Star5_Service_Image_Full.Visible = true
end)



-- Rating2



local Rating2 = Main.Rating2

Rating2.Star1_Service_Half.MouseButton1Click:Connect(function()
	Rating2.Star1_Service_Image_Half.Visible = true
	Rating2.Star2_Service_Image_Half.Visible = false
	Rating2.Star3_Service_Image_Half.Visible = false
	Rating2.Star4_Service_Image_Half.Visible = false
	Rating2.Star5_Service_Image_Half.Visible = false
	Rating2.Star1_Service_Image_Full.Visible = false
	Rating2.Star2_Service_Image_Full.Visible = false
	Rating2.Star3_Service_Image_Full.Visible = false
	Rating2.Star4_Service_Image_Full.Visible = false
	Rating2.Star5_Service_Image_Full.Visible = false
end)

Rating2.Star1_Service_Full.MouseButton1Click:Connect(function()
	Rating2.Star1_Service_Image_Half.Visible = false
	Rating2.Star2_Service_Image_Half.Visible = false
	Rating2.Star3_Service_Image_Half.Visible = false
	Rating2.Star4_Service_Image_Half.Visible = false
	Rating2.Star5_Service_Image_Half.Visible = false
	Rating2.Star1_Service_Image_Full.Visible = true
	Rating2.Star2_Service_Image_Full.Visible = false
	Rating2.Star3_Service_Image_Full.Visible = false
	Rating2.Star4_Service_Image_Full.Visible = false
	Rating2.Star5_Service_Image_Full.Visible = false
end)

Rating2.Star2_Service_Half.MouseButton1Click:Connect(function()
	Rating2.Star1_Service_Image_Half.Visible = false
	Rating2.Star2_Service_Image_Half.Visible = true
	Rating2.Star3_Service_Image_Half.Visible = false
	Rating2.Star4_Service_Image_Half.Visible = false
	Rating2.Star5_Service_Image_Half.Visible = false
	Rating2.Star1_Service_Image_Full.Visible = true
	Rating2.Star2_Service_Image_Full.Visible = false
	Rating2.Star3_Service_Image_Full.Visible = false
	Rating2.Star4_Service_Image_Full.Visible = false
	Rating2.Star5_Service_Image_Full.Visible = false
end)

Rating2.Star2_Service_Full.MouseButton1Click:Connect(function()
	Rating2.Star1_Service_Image_Half.Visible = false
	Rating2.Star2_Service_Image_Half.Visible = false
	Rating2.Star3_Service_Image_Half.Visible = false
	Rating2.Star4_Service_Image_Half.Visible = false
	Rating2.Star5_Service_Image_Half.Visible = false
	Rating2.Star1_Service_Image_Full.Visible = true
	Rating2.Star2_Service_Image_Full.Visible = true
	Rating2.Star3_Service_Image_Full.Visible = false
	Rating2.Star4_Service_Image_Full.Visible = false
	Rating2.Star5_Service_Image_Full.Visible = false
end)

Rating2.Star3_Service_Half.MouseButton1Click:Connect(function()
	Rating2.Star1_Service_Image_Half.Visible = false
	Rating2.Star2_Service_Image_Half.Visible = false
	Rating2.Star3_Service_Image_Half.Visible = true
	Rating2.Star4_Service_Image_Half.Visible = false
	Rating2.Star5_Service_Image_Half.Visible = false
	Rating2.Star1_Service_Image_Full.Visible = true
	Rating2.Star2_Service_Image_Full.Visible = true
	Rating2.Star3_Service_Image_Full.Visible = false
	Rating2.Star4_Service_Image_Full.Visible = false
	Rating2.Star5_Service_Image_Full.Visible = false
end)

Rating2.Star3_Service_Full.MouseButton1Click:Connect(function()
	Rating2.Star1_Service_Image_Half.Visible = false
	Rating2.Star2_Service_Image_Half.Visible = false
	Rating2.Star3_Service_Image_Half.Visible = false
	Rating2.Star4_Service_Image_Half.Visible = false
	Rating2.Star5_Service_Image_Half.Visible = false
	Rating2.Star1_Service_Image_Full.Visible = true
	Rating2.Star2_Service_Image_Full.Visible = true
	Rating2.Star3_Service_Image_Full.Visible = true
	Rating2.Star4_Service_Image_Full.Visible = false
	Rating2.Star5_Service_Image_Full.Visible = false
end)

Rating2.Star4_Service_Half.MouseButton1Click:Connect(function()
	Rating2.Star1_Service_Image_Half.Visible = false
	Rating2.Star2_Service_Image_Half.Visible = false
	Rating2.Star3_Service_Image_Half.Visible = false
	Rating2.Star4_Service_Image_Half.Visible = true
	Rating2.Star5_Service_Image_Half.Visible = false
	Rating2.Star1_Service_Image_Full.Visible = true
	Rating2.Star2_Service_Image_Full.Visible = true
	Rating2.Star3_Service_Image_Full.Visible = true
	Rating2.Star4_Service_Image_Full.Visible = false
	Rating2.Star5_Service_Image_Full.Visible = false

end)

Rating2.Star4_Service_Full.MouseButton1Click:Connect(function()
	Rating2.Star1_Service_Image_Half.Visible = false
	Rating2.Star2_Service_Image_Half.Visible = false
	Rating2.Star3_Service_Image_Half.Visible = false
	Rating2.Star4_Service_Image_Half.Visible = false
	Rating2.Star5_Service_Image_Half.Visible = false
	Rating2.Star1_Service_Image_Full.Visible = true
	Rating2.Star2_Service_Image_Full.Visible = true
	Rating2.Star3_Service_Image_Full.Visible = true
	Rating2.Star4_Service_Image_Full.Visible = true
	Rating2.Star5_Service_Image_Full.Visible = false
end)

Rating2.Star5_Service_Half.MouseButton1Click:Connect(function()
	Rating2.Star1_Service_Image_Half.Visible = false
	Rating2.Star2_Service_Image_Half.Visible = false
	Rating2.Star3_Service_Image_Half.Visible = false
	Rating2.Star4_Service_Image_Half.Visible = false
	Rating2.Star5_Service_Image_Half.Visible = true
	Rating2.Star1_Service_Image_Full.Visible = true
	Rating2.Star2_Service_Image_Full.Visible = true
	Rating2.Star3_Service_Image_Full.Visible = true
	Rating2.Star4_Service_Image_Full.Visible = true
	Rating2.Star5_Service_Image_Full.Visible = false

end)

Rating2.Star5_Service_Full.MouseButton1Click:Connect(function()
	Rating2.Star1_Service_Image_Half.Visible = false
	Rating2.Star2_Service_Image_Half.Visible = false
	Rating2.Star3_Service_Image_Half.Visible = false
	Rating2.Star4_Service_Image_Half.Visible = false
	Rating2.Star5_Service_Image_Half.Visible = false
	Rating2.Star1_Service_Image_Full.Visible = true
	Rating2.Star2_Service_Image_Full.Visible = true
	Rating2.Star3_Service_Image_Full.Visible = true
	Rating2.Star4_Service_Image_Full.Visible = true
	Rating2.Star5_Service_Image_Full.Visible = true
end)

-- Rating 3

local Rating3 = Main.Rating3

Rating3.Star1_Service_Half.MouseButton1Click:Connect(function()
	Rating3.Star1_Service_Image_Half.Visible = true
	Rating3.Star2_Service_Image_Half.Visible = false
	Rating3.Star3_Service_Image_Half.Visible = false
	Rating3.Star4_Service_Image_Half.Visible = false
	Rating3.Star5_Service_Image_Half.Visible = false
	Rating3.Star1_Service_Image_Full.Visible = false
	Rating3.Star2_Service_Image_Full.Visible = false
	Rating3.Star3_Service_Image_Full.Visible = false
	Rating3.Star4_Service_Image_Full.Visible = false
	Rating3.Star5_Service_Image_Full.Visible = false
end)

Rating3.Star1_Service_Full.MouseButton1Click:Connect(function()
	Rating3.Star1_Service_Image_Half.Visible = false
	Rating3.Star2_Service_Image_Half.Visible = false
	Rating3.Star3_Service_Image_Half.Visible = false
	Rating3.Star4_Service_Image_Half.Visible = false
	Rating3.Star5_Service_Image_Half.Visible = false
	Rating3.Star1_Service_Image_Full.Visible = true
	Rating3.Star2_Service_Image_Full.Visible = false
	Rating3.Star3_Service_Image_Full.Visible = false
	Rating3.Star4_Service_Image_Full.Visible = false
	Rating3.Star5_Service_Image_Full.Visible = false
end)

Rating3.Star2_Service_Half.MouseButton1Click:Connect(function()
	Rating3.Star1_Service_Image_Half.Visible = false
	Rating3.Star2_Service_Image_Half.Visible = true
	Rating3.Star3_Service_Image_Half.Visible = false
	Rating3.Star4_Service_Image_Half.Visible = false
	Rating3.Star5_Service_Image_Half.Visible = false
	Rating3.Star1_Service_Image_Full.Visible = true
	Rating3.Star2_Service_Image_Full.Visible = false
	Rating3.Star3_Service_Image_Full.Visible = false
	Rating3.Star4_Service_Image_Full.Visible = false
	Rating3.Star5_Service_Image_Full.Visible = false
end)

Rating3.Star2_Service_Full.MouseButton1Click:Connect(function()
	Rating3.Star1_Service_Image_Half.Visible = false
	Rating3.Star2_Service_Image_Half.Visible = false
	Rating3.Star3_Service_Image_Half.Visible = false
	Rating3.Star4_Service_Image_Half.Visible = false
	Rating3.Star5_Service_Image_Half.Visible = false
	Rating3.Star1_Service_Image_Full.Visible = true
	Rating3.Star2_Service_Image_Full.Visible = true
	Rating3.Star3_Service_Image_Full.Visible = false
	Rating3.Star4_Service_Image_Full.Visible = false
	Rating3.Star5_Service_Image_Full.Visible = false
end)

Rating3.Star3_Service_Half.MouseButton1Click:Connect(function()
	Rating3.Star1_Service_Image_Half.Visible = false
	Rating3.Star2_Service_Image_Half.Visible = false
	Rating3.Star3_Service_Image_Half.Visible = true
	Rating3.Star4_Service_Image_Half.Visible = false
	Rating3.Star5_Service_Image_Half.Visible = false
	Rating3.Star1_Service_Image_Full.Visible = true
	Rating3.Star2_Service_Image_Full.Visible = true
	Rating3.Star3_Service_Image_Full.Visible = false
	Rating3.Star4_Service_Image_Full.Visible = false
	Rating3.Star5_Service_Image_Full.Visible = false
end)

Rating3.Star3_Service_Full.MouseButton1Click:Connect(function()
	Rating3.Star1_Service_Image_Half.Visible = false
	Rating3.Star2_Service_Image_Half.Visible = false
	Rating3.Star3_Service_Image_Half.Visible = false
	Rating3.Star4_Service_Image_Half.Visible = false
	Rating3.Star5_Service_Image_Half.Visible = false
	Rating3.Star1_Service_Image_Full.Visible = true
	Rating3.Star2_Service_Image_Full.Visible = true
	Rating3.Star3_Service_Image_Full.Visible = true
	Rating3.Star4_Service_Image_Full.Visible = false
	Rating3.Star5_Service_Image_Full.Visible = false
end)

Rating3.Star4_Service_Half.MouseButton1Click:Connect(function()
	Rating3.Star1_Service_Image_Half.Visible = false
	Rating3.Star2_Service_Image_Half.Visible = false
	Rating3.Star3_Service_Image_Half.Visible = false
	Rating3.Star4_Service_Image_Half.Visible = true
	Rating3.Star5_Service_Image_Half.Visible = false
	Rating3.Star1_Service_Image_Full.Visible = true
	Rating3.Star2_Service_Image_Full.Visible = true
	Rating3.Star3_Service_Image_Full.Visible = true
	Rating3.Star4_Service_Image_Full.Visible = false
	Rating3.Star5_Service_Image_Full.Visible = false

end)

Rating3.Star4_Service_Full.MouseButton1Click:Connect(function()
	Rating3.Star1_Service_Image_Half.Visible = false
	Rating3.Star2_Service_Image_Half.Visible = false
	Rating3.Star3_Service_Image_Half.Visible = false
	Rating3.Star4_Service_Image_Half.Visible = false
	Rating3.Star5_Service_Image_Half.Visible = false
	Rating3.Star1_Service_Image_Full.Visible = true
	Rating3.Star2_Service_Image_Full.Visible = true
	Rating3.Star3_Service_Image_Full.Visible = true
	Rating3.Star4_Service_Image_Full.Visible = true
	Rating3.Star5_Service_Image_Full.Visible = false
end)

Rating3.Star5_Service_Half.MouseButton1Click:Connect(function()
	Rating3.Star1_Service_Image_Half.Visible = false
	Rating3.Star2_Service_Image_Half.Visible = false
	Rating3.Star3_Service_Image_Half.Visible = false
	Rating3.Star4_Service_Image_Half.Visible = false
	Rating3.Star5_Service_Image_Half.Visible = true
	Rating3.Star1_Service_Image_Full.Visible = true
	Rating3.Star2_Service_Image_Full.Visible = true
	Rating3.Star3_Service_Image_Full.Visible = true
	Rating3.Star4_Service_Image_Full.Visible = true
	Rating3.Star5_Service_Image_Full.Visible = false

end)

Rating3.Star5_Service_Full.MouseButton1Click:Connect(function()
	Rating3.Star1_Service_Image_Half.Visible = false
	Rating3.Star2_Service_Image_Half.Visible = false
	Rating3.Star3_Service_Image_Half.Visible = false
	Rating3.Star4_Service_Image_Half.Visible = false
	Rating3.Star5_Service_Image_Half.Visible = false
	Rating3.Star1_Service_Image_Full.Visible = true
	Rating3.Star2_Service_Image_Full.Visible = true
	Rating3.Star3_Service_Image_Full.Visible = true
	Rating3.Star4_Service_Image_Full.Visible = true
	Rating3.Star5_Service_Image_Full.Visible = true
end)

local function rating1check()
	if Rating1.Star5_Service_Image_Full.Visible == true then
		return "5"
	elseif Rating1.Star5_Service_Image_Half.Visible == true then
		return "4.5"
	elseif Rating1.Star4_Service_Image_Full.Visible == true then
		return "4"
	elseif Rating1.Star4_Service_Image_Half.Visible == true then
		return "3.5"
	elseif Rating1.Star3_Service_Image_Full.Visible == true then
		return "3"
	elseif Rating1.Star3_Service_Image_Half.Visible == true then
		return "2.5"
	elseif Rating1.Star2_Service_Image_Full.Visible == true then
		return "2"
	elseif Rating1.Star2_Service_Image_Half.Visible == true then
		return "1.5"
	elseif Rating1.Star1_Service_Image_Full.Visible == true then
		return "1"
	elseif Rating1.Star1_Service_Image_Half.Visible == true then
		return "0.5"
	end
	return "0"
end

Main.SendBtn.MouseButton1Click:Connect(function(rating1checked)
	rating1checked = rating1check()
	game.ReplicatedStorage.FlightRating.RE.Main:FireServer(rating1checked)
end)



local url = "i removed the webhook for safety purposes"
local http = game:GetService("HttpService")

local ReplicatedStorage = game:GetService("ReplicatedStorage")

local folder = Instance.new("Folder")
folder.Name = "ratings"
folder.Parent = script

ReplicatedStorage.FlightRating.RE.Main.OnServerEvent:Connect(function(plr)
	local function rating(number)
		for _, child in ipairs(plr.PlayerGui.FlightRating.Main["Rating"..number]:GetChildren()) do
			local stars, shape = child.Name:match("^Star(%d)_Service_Image_(%a+)$")
			if stars and shape then
				if shape == "Full" then
					return stars
				elseif shape == "Half" then
					return tostring(tonumber(stars) - 0.5)
				end
			end
		end
	end

	local rating1data, rating2data, rating3data = rating(1), rating(2), rating(3)

	local data = {
		['embeds'] = {{
			['title'] = "New Rating from "..plr.Name,
			['description'] = "Service: "..rating1data,
			['color'] = 3769131,
			['url'] = "https://www.roblox.com/isers/"..plr.UserId.."/profile"

		}}
	}

	local finaldata = http:JSONEncode(data)
	http:PostAsync(url, finaldata)
end)

You don’t have to use this, I just like cutting down scripts.

hmm I am not sure exactly what is wrong but maybe take a look at this:

The reason the error occurs is because the server can’t see local changes on the player UI, made by a LocalScript. To make the script work you should move the UI code on the client, and use remotes to send the ratings to the server(I also cleaned the script for the shake of readability):

--LocalScript
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players") 

local Player = Players.LocalPlayer 
local PlayerUI = Player:WaitForChild("PlayerGui") 

local main = PlayerUI:WaitForChild("FlightRating"):WaitForChild("Main")

function getRating(category)
	local UI = main:WaitForChild("Rating"..category) 
	local highestStar = 0
	local isFull = false 
	for _, frame in pairs(UI:GetChildren()) do 
		if not (frame:IsA("GuiObject") and frame.Visible) then continue end --ignore if the star isn't selected
		local starString = frame.Name:gsub("%D", "") --only keeping the number inside the frame name(the star)  
		local star = tonumber(starString)
		if not star then continue end 
		--if the star is bigger than the old one, or a FULL and same as the old one, update the highest value
		local full = frame.Name:find("Full")
		if star > highestStar or (star == highestStar and full) then 
			highestStar = star 
			isFull = full 
		end
	end
	if isFull then 
		return highestStar 
	else 
		return highestStar-0.5
	end
end

--code here should run after the player rates the game
local rating1data = getRating(1)
local rating2data = getRating(2)
local rating3data = getRating(3)

ReplicatedStorage.FlightRating.RE.Main:FireServer({rating1data, rating2data, rating3data})
--Your server script
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local HttpService = game:GetService("HttpService")

local webhook = ""

local folder = Instance.new("Folder", script)
folder.Name = "ratings"

function validate(ratings) 
	local function check(rate)
		if not rate then return false end 
		rate = tonumber(rate) 
		if rate >= 0 and rate <= 5 then 
			return true 
		else 
			return false 
		end
	end
	
	local rate1 = ratings[1] 
	local rate2 = ratings[2] 
	local rate3 = ratings[3] 
	
	if check(rate1) and check(rate2) and check(rate3) then 
		return true --only returns true if all the ratings are between 0 and 5
	else 
		return false 
	end
end

ReplicatedStorage.FlightRating.RE.Main.OnServerEvent:Connect(function(player, ratings)
	if not validate(ratings) then --also only allow each user to vote once, they may use it as a way to spam your webhook requests
		warn(player.Name, " rating request was invalid!") --maybe exploiting?
		return 
	end

	local data = {
		embeds = {{
			title = "New Rating from "..player.Name,
			description = "Service: "..ratings[1], --currently only sends the first rating, you can change that by formatting text using ratings[2], ratings[3], etc.
			color = 3769131,
			url = "https://www.roblox.com/users/"..player.UserId.."/profile"
		}}
	}

	local encodedData = HttpService:JSONEncode(data)
	HttpService:PostAsync(webhook, encodedData)
end)

PS: Also as far I’m aware, Discord blocks any requests made by Roblox servers, which means in order to make the webhook work on actual live servers(outside studio) you must use a proxy.

1 Like