So I’m trying to make a super simple admin/debugging thing where I can do commands by using the F9 command prompt, but I’m stuck on this error:
12:44:16.930 Workspace.Admin.AdminScript:63: attempt to index nil with ‘Character’ - Server - AdminScript:63
The teleporting part does not work with finding the humanoid, also maybe the CFrame doesnt work either but I have not tested that yet because its stuck on humanoid part.
local S = script.Parent.Scare -- Jumpscare
local D = script.Parent.Day -- Day set
local TP = script.Parent.TP -- Teleporting to XYZ
local User = script.Parent.User -- User Selected
S.Changed:Connect(function()
local m = game.Lighting.ColorCorrection4roguard
game.SoundService.Sound2.TimePosition = 0
game.SoundService.Sound2.Playing = true
wait(3)
for x = 0,-1,-0.05 do
m.Saturation = x
wait(0.1)
end
for x = 0,-0.7,-0.05 do
m.Brightness = x
wait(0.2)
end
wait(3)
game.SoundService.Sound3.TimePosition = 0
game.SoundService.Sound3.Playing = true
wait(4)
for x = -0.2,0,0.05 do
m.Brightness = x
wait(0.2)
end
for x = -0.7,0,0.05 do
m.Saturation = x
wait(0.1)
end
end)
D.Changed:Connect(function()
local p = tonumber(D.Value)
if p then
local sr = game.Lighting.SunRays
local s = game.Lighting.skybox
local a = game.Lighting.Atmosphere
local t = game.Workspace.Terrain
local n = 167*D.Value
local n2 = 0.02*D.Value
local d = game.Workspace.Day
local n = D.Value*3
game.Lighting.OutdoorAmbient = Color3.fromRGB(n, n, n)
d.Value = D.Value
t.WaterWaveSize = d.Value/10
t.WaterWaveSpeed = d.Value
sr.Intensity = 0.302+n2
s.SunAngularSize = 1.15^D.Value
s.StarCount = 5000-n
local n = 101 + d.Value
local x = s.SunAngularSize
t:SetMaterialColor(Enum.Material.Grass, Color3.fromRGB(n, 126, 62))
game.Workspace.GlobalWind = Vector3.new(x,0,0)
if d.Value >= 29 then
a.Haze = 3
else
a.Haze = 1
end
end
end)
TP.Changed:Connect(function()
local player = game.Players:FindFirstChild(User.Value)
local character = player.Character
local str = TP.Value -- stringified cframe
local cefra = str:split(",")
character:PivotTo(CFrame.new(unpack(cefra)))
end)