#Can anyone correct my scripting mistake here?
186 messages · Page 1 of 1 (latest)
Script 'Workspace.TriggerPart.Script', Line 6
Camera is not a valid member of Player "Players.d0mszO"
feel free to call me a idiot
if u want to maniulplate the players camrea
then use a local script
local CurrentCamera = workspace.CurrentCamera
thats how u refrence the players camera
hm okay
Workspace.TriggerPart.Script:3: attempt to index nil with 'Touched'
local CurrentCamera = workspace.CurrentCamera
part.Touched:Connect(function(hit)
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if player then
local camera = player.Camera
camera.CameraType = Enum.CameraType.Scriptable
camera.CFrame = CFrame.new(part.Position, part.Position + Vector3.new(0, 5, 35))
end
end)
i have zero knowledge of lua
** You are now Level 10! **
and i just wanted to make a game
that can help me get a little bit of robux
Really?
yea
W
Don’t say that
dude he said i could
No the f part
local CurrentCamera = workspace.CurrentCamera
part.Touched:Connect(function(hit)
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if player then
local camera = player.Camera
camera.CameraType = Enum.CameraType.Scriptable
camera.CFrame = CFrame.new(part.Position, part.Position + Vector3.new(0, 5, 35))
end
end)
but what the fuck do i add here
Camera is workspace.CurrentCamera
Try that and u don’t need local script for it
Where’s the part variable
Workspace.TriggerPart.Script:4: attempt to index nil with 'Touched'
Do u have local part = script.Parent?
well if ur changing the local players camera then i would think so
just wanted a trigger part that changes the cameras angle into 2d
Prob but I don’t work with camera manipulation
no
Okay add it
First line add it
Or first empty line
Legit same thing
But for that, (since u said I can) ur an idiot
local part = script.Parent
local CurrentCamera = workspace.CurrentCamera
local TriggerPart = workspace:WaitForChild("TriggerPart")
part.Touched:Connect(function(hit)
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if player then
local camera = player.Camera
camera.CameraType = Enum.CameraType.Scriptable
camera.CFrame = CFrame.new(part.Position, part.Position + Vector3.new(0, 5, 35))
end
end)
Camera is not a valid member of Player "Players.d0mszO"
'Workspace.TriggerPart.Script', Line 8
got back from where i started
local part = script.Parent
local Camera = workspace.Camera
local TriggerPart = workspace:WaitForChild("TriggerPart")
part.Touched:Connect(function(hit)
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if player then
local camera = player.Camera
camera.CameraType = Enum.CameraType.Scriptable
camera.CFrame = CFrame.new(part.Position, part.Position + Vector3.new(0, 5, 35))
end
end)
like this?
In the part touched function, remove the camera variable that is inside it
local part = script.Parent
local camera = workspace.Camera
local TriggerPart = workspace:WaitForChild("TriggerPart")
part.Touched:Connect(function(hit)
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if player then
camera.CameraType = Enum.CameraType.Scriptable
camera.CFrame = CFrame.new(part.Position, part.Position + Vector3.new(0, 5, 35))
end
end)
Use that
Give me 3 mins I gotta do smth
okay
Okay back
Is it a local script or regular script?
I don’t have time for ur answer so if it’s a local script, change it into a regular script. But if it’s a regular script, really nothing can be done because this is Roblox’s issue that hasn’t been addressed.
has he gotten it
Regular script
what error is it giving
that just gives me an error
what it say
local part = script.Parent
local Camera = workspace.CurrentCamera
local TriggerPart = workspace:WaitForChild("TriggerPart")
part.Touched:Connect(function(hit)
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if player then
local camera = player.Camera
camera.CameraType = Enum.CameraType.Scriptable
camera.CFrame = CFrame.new(part.Position, part.Position + Vector3.new(0, 5, 35))
end
end)
this
do this
no
dont do thta
cause ur trying to find camera inside player when its not
its in like gui
or some crazy shit
idfk
try this
Script 'Workspace.TriggerPart.Script', Line 8 - Studio - Script:8
allergic to reading
hit up my good pal devking!
I have a gf, this is just my side quest
whats his name
HIS???
oh my bad
jerico
manly
exactly
** You are now Level 3! **
youre going to loser town
eh i dont wanna disturb ur home there
you got an entire bloodline there
youre the creator of it
thats very meaningful to me
i dont even live there
you're an adult right?
adult guy harrasses minor
minor
14
- go to game.StarterPlayer.StarterPlayerScripts
- crate a localscript
- paste:
local TriggerPart = workspace:WaitForChild("TriggerPart")
local Player = game:GetService("Players").LocalPlayer
TriggerPart.Touched:Connect(function(HitPart)
if not (HitPart.Parent == Player.Character) then return end
local Camera = workspace.CurrentCamera
Camera.CameraType = Enum.CameraType.Scriptable
Camera.CFrame = CFrame.new(TriggerPart.Position, TriggerPart.Position + Vector3.new(0, 5, 35))
end)
oh shit
didnt work
yea
where did you make it
starterplayerscripts
i added the triggerpart into workspace
localscripts only run in StarterPlayerScripts, Character and PlayerGui.
you can try changing it to this:
print(script:GetFullName())
local TriggerPart = workspace:WaitForChild("TriggerPart")
local Player = game:GetService("Players").LocalPlayer
print(TriggerPart)
TriggerPart.Touched:Connect(function(HitPart)
print(HitPart)
if not (HitPart.Parent == Player.Character) then return end
print("setting camera..")
local Camera = workspace.CurrentCamera
Camera.CameraType = Enum.CameraType.Scriptable
Camera.CFrame = CFrame.new(TriggerPart.Position, TriggerPart.Position + Vector3.new(0, 5, 35))
end)
and send the console output here
is trigger part in workspace?
hm
yea
run this code send output
and btw i have this set as the default camera
it just sets the camera to be 5 studs higher and 35 studs to positive Z from the trigger
i just wanted the camera to go 2d
Camera.CameraType = Enum.CameraType.Custom custom = default camera type
oh
in this video, Ill show you how to make a script that will make the player only see from one angle. Its called 2D Camera
🎮 Check out the Gaming Channel: https://bit.ly/3L13q1i
🌟 SUBSCRIBE HERE! 🌟
https://www.youtube.com/c/DevySub
🔔 Be sure to hit the bell and turn on notifications! 🔔
💙 SOCIAL MEDIA 💙
👑Roblox Group👑
https://bit.ly/J...
I mean
this will set camera back to normal
i wanted it to be set into like this 2d view
local RunService = game:GetService("RunService")
local Camera = workspace.CurrentCamera
local Character = script.Parent
local Humanoid = Character:WaitForChild("HumanoidRootPart")
local TriggerPart = workspace:WaitForChild("TriggerPart")
-- settings
local CameraOffset = Vector3.new(0, 5, 10)
local Debounce = .5
-- /settings
local RenderConnection
function Start2DCamera()
Camera.CameraType = Enum.CameraType.Scriptable
RenderConnection = RunService.RenderStepped:Connect(function()
Camera.CFrame = Camera.CFrame:Lerp(CFrame.new(Humanoid.Position + CameraOffset, Humanoid.Position), 0.1)
end)
end
function Stop2DCamera()
RenderConnection:Disconnect()
Camera.CameraType = Enum.CameraType.Custom
end
local Enabled = false
local DebounceTimer = os.clock()
TriggerPart.Touched:Connect(function(HitPart)
if not (HitPart.Parent == Character) then return end
if os.clock() - DebounceTimer < Debounce then return end
DebounceTimer = os.clock()
Enabled = not Enabled
if Enabled then
Start2DCamera()
else
Stop2DCamera()
end
end)
put this in StarterCharacterScripts
okay
localscript inside starterCHARACTERscripts
alr
then?
wait
i have to turn off the camera im using just to get this 2d camera?
sad
it works but the direction is centered
@neat wagon anyway to change the direction of the camera?
what you mean
CameraOffset
--//Settings//--
local zoom = 140
local FieldOfView = 7
--//Do not edit unless you know what you're doing//--
local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()
local Character = Player.Character or Player.CharacterAdded:Wait()
local Camera = game.Workspace.CurrentCamera
Camera.CameraType = Enum.CameraType.Custom
local RunService = game:GetService("RunService")
RunService.RenderStepped:Connect(function()
Camera.FieldOfView = FieldOfView
if Character then
if Character:FindFirstChild("Head") then
game:GetService("SoundService"):SetListener(Enum.ListenerType.ObjectCFrame, Character.Head)
Camera.CFrame =
CFrame.new(Vector3.new(Character.Head.Position.X + zoom, Character.Head.Position.Y + zoom, Character.Head.Position.Z + zoom), Character.Head.Position)
end
end
end)
this is the script im using
for the default camera
i realize that i should have
to delete it
to make the 2d camera work
yeah it will interfere with this camera script
how can i connect these both?
stop one script - enable other
oh?