I got the error said in the title on this line and it has confused me.
data:SetAsync(playercuffed.userId.."/Arrests/"..os.time(),'{"Time":'.. arresttime .. ',"Reason":"'.. reason..'","Arrester":"'.. plr.Name..'","Court":false,"Served":true}')
I got the error said in the title on this line and it has confused me.
data:SetAsync(playercuffed.userId.."/Arrests/"..os.time(),'{"Time":'.. arresttime .. ',"Reason":"'.. reason..'","Arrester":"'.. plr.Name..'","Court":false,"Served":true}')
The error is self explanatory; you tried to combine an instance with a string.
Try and print each variable. At least one of them is an instance, and you should add .Name to the end of it or change the variable.
If the instance you found is a ___Value, add .Value to the end instead.
Hope this helps!
It also gave this error on another line, is this the sane as above.
_G.oofofthedoofmcoof:post{username = "[Arrest] "..plr.Name.." : "..plr.UserId, content = "Arrested: ".. playercuffed.Name .. "\nReason:" .. reason .. "\nArrestTime: ".. arresttime}
Hate to be annoying you able to break this down a tad too, late night and I have lost multiple brains tonight.
Same thing. I suspect that arresttime
or reason
may be StringValues or NumberValues.
They are put as strings before it fires.
local Reason = Player.PlayerGui:WaitForChild("ArrestUI"):WaitForChild("Frame").Reason
local ReasonString = tostring(Reason.Text)
local Time = Player.PlayerGui:WaitForChild("ArrestUI"):WaitForChild("Frame").Time
local TimeString = tostring(Time.Text)
Player.PlayerGui:WaitForChild("ArrestUI"):WaitForChild("Frame"):WaitForChild("ConfirmArrest").MouseButton1Click:Connect(function()
if string.len(Reason.Text) >= 5 then
if Time > 900 then Time = 900 end
if Time < 10 then Time = 10 end
end
game.ReplicatedStorage.PoliceEvents.ArrestEvent:FireServer(Current_Target, Time, Reason)
end)
As @daisytheghostchild98 mentioned, if it happens on both lines then either arresttime
or reason
is an instance, try running this before both lines:
print(type(arresttime), type(reason))
Are Frame.Reason
and Frame.Time
both some sort of value object? If so, replace them with this:
local Reason = Player.PlayerGui:WaitForChild("ArrestUI"):WaitForChild("Frame").Reason.Value
local ReasonString = tostring(Reason.Text)
local Time = Player.PlayerGui:WaitForChild("ArrestUI"):WaitForChild("Frame").Time.Value
local TimeString = tostring(Time.Text)
Note: If both are StringValues, there is no need to use a tostring()
(I also believe numbers concatenate with strings too).
What is the reason as to why it is now a Value?
Any kind of value: StringValue, IntValue, NumberValue, even Vector3Value, all have a Value property.
If you are using any kind of value like above, you should use .Value to call for the assigned value, not the instance itself.
I didn’t understand as the two things that you have put as values are text?
It has returned this error
"Value is not a member of TextBox “Players.ArchieStatixx.PlayerGui.ArrestUI.Frame.Reason”
Then you should use .Text at the end instead (which means you don’t need a tostring):
local Reason = Player.PlayerGui:WaitForChild("ArrestUI"):WaitForChild("Frame").Reason.Text)
local Time = Player.PlayerGui:WaitForChild("ArrestUI"):WaitForChild("Frame").Time.Text
Hope this helps!
I can’t believe no one noticed this yet, you passed in the wrong parameters, you passed in the text box instances and not there text, fixed script (and removed unnecessary tostring)
local Reason = Player.PlayerGui:WaitForChild("ArrestUI"):WaitForChild("Frame").Reason
local ReasonString = Reason.Text
local Time = Player.PlayerGui:WaitForChild("ArrestUI"):WaitForChild("Frame").Time
local TimeString = Time.Text
Player.PlayerGui:WaitForChild("ArrestUI"):WaitForChild("Frame"):WaitForChild("ConfirmArrest").MouseButton1Click:Connect(function()
if string.len(Reason.Text) >= 5 then
if Time > 900 then Time = 900 end
if Time < 10 then Time = 10 end
end
game.ReplicatedStorage.PoliceEvents.ArrestEvent:FireServer(Current_Target, TimeString, ReasonString)
end)