Hi,
I am a Scripter. I have a functional radio I made, and when I say CLEAR ONE [USERNAME] in this case it's iiLevelMaker, it says my plate which is COE 962 because it gets randomized.
But when my friend joins and I do CLEAR ONE prxcid, it gets the same license plate everytime.
Screenshot: http://prntscr.com/m3hyai
Script:
local DSService = game:GetService("DataStoreService"):GetDataStore("CoreDatabsdd84")
local letters = {'a', 'b', 'c', 'd', 'e', 'f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'}
game.Players.PlayerAdded:Connect(function(Player)
local Scope = 'id-'..Player.userId
local PlayerData = Instance.new("Folder")
PlayerData.Parent = game:GetService("ReplicatedStorage")
PlayerData.Name = Player.Name.."Data"
local OnValue = Instance.new("BoolValue")
OnValue.Parent = PlayerData
OnValue.Value = false
OnValue.Name = "OnValue"
local Arrests = Instance.new("IntValue")
Arrests.Parent = PlayerData
Arrests.Name = "Arrests"
Arrests.Value = 0
local hasPermit = Instance.new("BoolValue")
hasPermit.Parent = PlayerData
hasPermit.Name = "hasPermit"
hasPermit.Value = false
local l1 = letters[math.random(#letters)]:upper()
local l2 = letters[math.random(#letters)]:upper()
local l3 = letters[math.random(#letters)]:upper()
local n1 = math.random(0,9)
local n2 = math.random(0,9)
local n3 = math.random(0,9)
local Plate = Instance.new("StringValue")
Plate.Parent = PlayerData
Plate.Name = "Plate"
Plate.Value = l1..l2..l3.." "..n1..n2..n3
local GetSaved = DSService:GetAsync(Scope)
if GetSaved then
Arrests.Value = GetSaved[1]
Plate.Value = GetSaved[2]
else
local NumbersForSaving = {Arrests.Value, Plate.Value}
DSService:SetAsync(Scope, NumbersForSaving)
end
end)
game.Players.PlayerRemoving:Connect(function(Player)
local Scope = 'id-'..Player.userId
local Savetable = {game:GetService("ReplicatedStorage"):FindFirstChild(Player.Name.."Data").Arrests.Value, game:GetService("ReplicatedStorage"):FindFirstChild(Player.Name.."Data").Plate.Value}
DSService:SetAsync(Scope, Savetable)
end)
game.Players.PlayerAdded:Connect(function(Player)
Player.Chatted:Connect(function(msg)
if game:GetService("ReplicatedStorage"):FindFirstChild(Player.Name.."Data").OnValue.Value == true then
local clearonecommand = string.sub(msg, 1, 10) == "CLEAR ONE "
local targetPlayer = game:GetService("Players"):FindFirstChild(string.sub(msg, 11))
if targetPlayer then
local Channel = workspace.RadioSystem
local ArrestCount = game:GetService("ReplicatedStorage"):FindFirstChild(Player.Name.."Data").Arrests
local PermitBool = game:GetService("ReplicatedStorage"):FindFirstChild(Player.Name.."Data").hasPermit
local Permit
if PermitBool.Value == false then
Permit = "No"
elseif PermitBool.Value == true then
Permit = "Yes"
end
Channel.Line1.Value = Channel.Line2.Value
Channel.Line2.Value = Channel.Line3.Value
Channel.Line3.Value = Channel.Line4.Value
Channel.Line4.Value = Channel.Line5.Value
Channel.Line5.Value = Channel.Line6.Value
Channel.Line6.Value = Channel.Line7.Value
Channel.Line7.Value = "Dispatch: Username: "..targetPlayer.Name..", Arrests: "..ArrestCount.Value..", Has FOID: "..Permit..", Plate: "..tostring(game:GetService("ReplicatedStorage"):FindFirstChild(Player.Name.."Data").Plate.Value)
game:GetService("ReplicatedStorage").updateRadioClients:FireClient(Player)
end
end
end)
end)

1 comment
Only worry about when it saves and loads and the generator.