I’m trying to make it so where if you say “RUN NAME username” it shows some info and a couple of values however those values aren’t updating.
basically if I change the value of say the arrests or citations it stays the same as it was before
LOCAL SCRIPT
Player.Chatted:Connect(function(ChatMessage)
if ChatMessage then
if CurrentChannel == "Dispatch" then
if ChatMessage == "RUN NAME "..game.Players:FindFirstChild(string.split(ChatMessage, " ")[3]).Name then
local PlayerRunne = game.Players:FindFirstChild(string.split(ChatMessage, " ")[3])
local ArrestsValue = game.Players:FindFirstChild(string.split(ChatMessage, " ")[3]).Arrests
local CitationsVal = game.Players:FindFirstChild(string.split(ChatMessage, " ")[3]).Citations
local WarrantsValue = game.Players:FindFirstChild(string.split(ChatMessage, " ")[3]).Warrants
RadioRemoteEvents.RunPlayer:FireServer(PlayerRunne, ArrestsValue, CitationsVal, WarrantsValue)
end
end
end
end)
SERVER SCRIPT
radioFolder.RunPlayer.OnServerEvent:Connect(function(Player, PlayerRunne, ArrestsValue, CitationsVal, WarrantsValue)
wait()
FrameTo_output.LineOne.Text = "DISPATCH: "..PlayerRunne.Name.." has "..ArrestsValue.Value.." arrests, here he has "..CitationsVal.Value.." citations total, a warrant comes back as, "..tostring(WarrantsValue.Value).." , this is all the information we have! "
end)
This should be in a SeverScript not LocalScript. Try-
game.Players.PlayerAdded:Connect(function(player)
player.Chatted:Connect(function(message)
local division = string.split(message, ' ')
pcall(function()
if division[1] == 'RUN' and division[2] == 'NAME' and division[3] then
-- Code here
end
end)
end)
end)
--- Local scripts cannot recognize/execute server code, they will throw the default value assigned as a player chatting is server wide and appears to the whole server, not just the client.
You don’t need to use any remote events, just directly put the whole code into the server script.
One more thing, sometimes values do not change when I fire them through a remote event, such as-
local a = 'HelloWorld'
remoteEvent:FireClient(player, a) -- THe client shows a message called "unable to convert Instance to string".
remoteEvent:FireClient(player, 'HelloWorld') -- Works properly.