Can proximityPrompts affect player camera?

I have this ModuleScript
the line that is blocking me is cam.CFrame and cam.CameraType

'local RunService = game:GetService(“RunService”)
local ReplicatedStorage = game:GetService(“ReplicatedStorage”)

local ObjectActions = {}

– Actions for when prompt is triggered
function ObjectActions.promptTriggeredActions(promptObject, player)

end
– Actions for when prompt hold begins
function ObjectActions.promptHoldBeganActions(promptObject, player)

local ancestorModel = promptObject:FindFirstAncestorWhichIsA("Part")
if ancestorModel.Name == "Customization" then
	local Gui = ReplicatedStorage.Costumization:Clone()
	local car = game.Workspace[player.Name.."sCar"]
	local postie = Vector3.new(-2945.022, 13.177, -2584.317)
	local focus = Vector3.new(-2958.812, 8.735, -2571.332)
	local character = player.Character
	local Position = CFrame.new(-2986.076, -45.09, -2429.76)
	local cam = workspace.CurrentCamera
	
	Gui.Parent = player.PlayerGui
	
	cam.CFrame = CFrame.new(postie,focus)
	cam.CameraType = Enum.CameraType.Scriptable

	
	character:SetPrimaryPartCFrame(Position)
	
	player.PlayerGui["A-Chassis Interface"].Enabled = false
	
	car.DriveSeat.Rev.Volume = 0
	car:SetPrimaryPartCFrame(CFrame.new(-2959.282, 8.21, -2568.518) * CFrame.Angles(0,math.rad(-10),0))
	
	
	car.Garaj.Value = true
	
end

end
– Actions for when prompt hold ends
function ObjectActions.promptHoldEndedActions(promptObject, player)

end

return ObjectActions’

You almost formatted the code right

Can’t you just fire a RemoteEvent instead so that it’ll change the Camera’s CFrame on the client side?

(Also just noticed this):

Ok thanks for the help but were i should place the script or local script?Inside the GUI?

Well, you’d need to implement 2 scripts: A Server and a Local Script

The Server will handle the RemoteEvent to fire to the client when the prompt gets activated, while the Local will change the Camera’s CFrame

Maybe you can implement something like this?

--This should be a ServerScript parented inside the Part

local Event = game.ReplicatedStorage:WaitForChild("RemoteEvent")
local Prompt = script.Parent.ProximityPrompt
local Model = Part:FindFirstAncestorWhichIsA("Part")

Prompt.Triggered:Connect(function(Player)
    Event:FireClient(Player, Model)
end) 

And on the client side:

--Just parent this anywhere inside 1 of the client-replicated areas, supposedly StarterPlayerScripts
local player = game.Players.LocalPlayer
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local RunService = game:GetService("RunService")
local Event = ReplicatedStorage:WaitForChild("RemoteEvent")

Event.OnClientEvent:Connect(function(Model)
    if Model.Name == "Customization" then
    	local Gui = ReplicatedStorage.Costumization:Clone()
	    local car = game.Workspace[player.Name.."sCar"]
    	local postie = Vector3.new(-2945.022, 13.177, -2584.317)
	    local focus = Vector3.new(-2958.812, 8.735, -2571.332)
	    local character = player.Character
	    local Position = CFrame.new(-2986.076, -45.09, -2429.76)
	    local cam = workspace.CurrentCamera
	
	    Gui.Parent = player.PlayerGui
	
	    cam.CFrame = CFrame.new(postie,focus)
	    cam.CameraType = Enum.CameraType.Scriptable

	
	    character:SetPrimaryPartCFrame(Position)
	
	    player.PlayerGui["A-Chassis Interface"].Enabled = false
	
	    car.DriveSeat.Rev.Volume = 0
	    car:SetPrimaryPartCFrame(CFrame.new(-2959.282, 8.21, -2568.518) * CFrame.Angles(0,math.rad(-10),0))
	
	
	    car.Garaj.Value = true
    end
end)
2 Likes

**Nvm I managed to solve it by changing Part with script.Parent.ProximityPrompt **

by Part(Part:FindFirstAncestor…) what do you mean?

It’s the same thing as this in your other script, except we’re firing that Remote & checking it’s name on the client side

1 Like