Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How exactly would i trigger CameraManipulation when a player touches a part?

Hello, I have recently tried CameraManipulation and want to trigger it with a part in workspace. I want it so it triggers when a player touches the TriggerPart and stops when the player moves away from the TriggerPart. I am having difficulty with scripting this and need some help.

To give you a basic idea: -There is a part in workspace called CamPart (The one that is used for the camera, Not as a trigger.) -Part in workspace called TriggerPart. (Used for triggering the script when a player touches.) -ScreenGUI in StarterGUI with a LocalScript.

The script in StarterGUI is as follows:

local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Camera = workspace.CurrentCamera

repeat wait()
	Camera.CameraType = Enum.CameraType.Scriptable
until Camera.CameraType == Enum.CameraType.Scriptable
Camera.CFrame = workspace.CamPart.CFrame

Thank you for your time!

1 comment

0

.Touched, look it up.

2 answers

here.

  • PUT IN A PART (INVISIBLE + NOCOLLIDE)
local debounce = false

function TouchEvent(Trigger)
  if debounce == false and Trigger.Parent:FindFirstChild("Humanoid") then
local Player = game.Players[Trigger.Parent.Name]
local Character = Player.Character or Player.CharacterAdded:Wait()
local Camera = workspace.CurrentCamera
debounce = true

repeat wait()
    Camera.CameraType = Enum.CameraType.Scriptable
until Camera.CameraType == Enum.CameraType.Scriptable
Camera.CFrame = workspace.CamPart.CFrame
 end
end

script.Parent.Touched:Connect(TouchEvent)

11 comments

0

forgot debounce values, edited in.

0

Still won't trigger for some reason.. Is there something i'm missing?

0

give me the problem / error

0

The script which i stated was in startergui, there are also 2 parts in workspace. CamPart, The one associated with the script, And TriggerPart, The one the player steps on to trigger the script in startergui.

0

ah, i realise my error hold on.

0

i edited it, try the script on 1 part now. (I can't test it right now, sorry) - this script should also work for all players now

0

So i insert the script inside TriggerPart?

0

yes - if you want it local make it game.Players.LocalPlayer in a localscript.

0

I still have trouble getting it to work. Mind if i link you a free model of it that i uploaded?

0

i can't access the roblox website and i can't access roblox studio currently, therefore i'm only trying to help to my best extent. Sorry. - if there's still problems later when i can i'll surely test it out.

0

Oh, Alright.

This discussion is preserved as it was. New answers, comments, and votes are closed.