Hi there. I’m trying to make a group rank script, but I get this error.
localscipt:
local event = game.ReplicatedStorage.RankEvent
script.Parent.MouseButton1Click:Connect(function()
local UserId = tonumber(script.Parent.Parent.UserID.Text)
local RankId = tonumber(script.Parent.Parent.RankID.Text)
if not UserId or not RankId then return end
event:FireServer(UserId, RankId)
end)
serverscript:
local GlitchURL = "https://###########/" --Place the glitch project URL inside of the quotes
function rankUser(UserId, RoleId)
game:GetService("HttpService"):GetAsync(GlitchURL .. "ranker?userid=" .. UserId .. "&rank=" .. RoleId)
end
end)
end
game.ReplicatedStorage.RankEvent.OnServerEvent:Connect(function(player, UserId, RoleId)
rankUser(UserId, RoleId)
end)
I tagged the URL because I don’t know if someone could do something to my group or not.
error:
ServerScriptService.Script:4: attempt to concatenate nil with string
May be because you are sending the player to the server. FYI, a remote evnt from client already sends the player, so remove the player part in the remote event. That should fix it, because you are sending two players.wd
UserId or RankId returns probably nil. This may be because of the text. If it contains a letter, it’ll return nil because you use tonumber. Check the texts if it does.
I think the issues stem from: script.Parent.Parent.UserID.Text script.Parent.Parent.RankID.Text
Not exactly sure how, but to think of it, the text might have converted to nil when it contained non-numbers. It’s somewhere around about user’s input to change the text not working as intended?
I might be wrong but I’m pretty sure you don’t need to pass the client when firing to the server, and MouseButton1Click doesn’t return a player.
Also you may want to check if the userid and rankid is valid.
local event = game.ReplicatedStorage.RankEvent
script.Parent.MouseButton1Click:Connect(function()
local UserId = tonumber(script.Parent.Parent.UserID.Text)
local RankId = tonumber(script.Parent.Parent.RankID.Text)
if not UserId or not RankId then return end
event:FireServer(UserId, RankId)
end)