So I am creating an admin command bar is one of the commands are: !warn . Now for this command to function, I have a remote event and a server and local script. Now I don't know if it's the remote event or something but I keep getting this error: Unable to cast "value" to object. Please help me find a solution!
Local Script: -- Yes, yes I know I shouldn't use the draggable thingy but whatever.
*Error is in local script, line 20
local frame = script.Parent
frame.Draggable = true
frame.Active = true
frame.Selectable = true
local Event = game:GetService("ReplicatedStorage")["Admin Events"].WE
script.Parent.Close.MouseButton1Click:Connect(function()
script.Parent.Visible = false
end)
local MainFrame = script.Parent.MainFrame
MainFrame.Submit.MouseButton1Click:Connect(function()
local target = MainFrame.Player.Text
local reason = MainFrame.Reason.Text
if target.Text ~= "" then
Event:FireClient(target,reason)
end
end)
Server Script:
local File = game:GetService("ReplicatedStorage")
local FileName = "Admin Events"
local Object = File[FileName]["WE"]
local Admins = {"suspectshot108","SithVirtus","adam7adam"}
Object.OnServerEvent:Connect(function(player,target,reason)
local msg = Instance.new("Message",workspace)
local text = "[From:] "..player.." [Message]: "..reason
for i = 1,#text do
msg.Text = string.sub(text,1,i)
wait(.07)
end
wait(3)
msg:Remove()
end)

2 comments
um which line is the error on
Local Script, 20