Hey Everyone! so i’m Currently Working on a Horror Game. & i’m trying to make a Proximity Prompt when it’s Triggered it will give the Player a View Model. But it’s not Working. How do i do this?
My Current Script :
Hey Everyone! so i’m Currently Working on a Horror Game. & i’m trying to make a Proximity Prompt when it’s Triggered it will give the Player a View Model. But it’s not Working. How do i do this?
My Current Script :
Is the code inside a local script?
Yes, the code is inside a Local Script
Alright, do something like this:
ProximityPrompt.Triggered:Connect(function()
RunService.RenderStepped:Connect(function()
-- Render code here
end)
end)
i already tried that before but it still didn’t worked.
Is the proximityprompt and the RenderStepped
working normally? You can check by printing
Yes both of them are working correctly
Then the problem might lies in your view model code
I heavily recommend the use of RunService:BindToRenderStep()
as it adds more functionality (specifically :UnbindFromRenderStep()
) and makes code much more readable
I don’t really see why the render step is necessary unless in missing something, but I would move everything inside the render step directly into the prompt triggered event and see if that works.
Viewmodels require to be set to the position of the camera every frame, because the camera isnt a physical object you cant just simply weld it to camera
Can you tell me more about View Model? I dunno what VMChair and ChairProp are
VMChair is the Viewmodel & ChairProp is just a Prop
Oops I must have missed that. Only the camera should be inside the loop since parenting, prompt disabling, and destroying the model don’t need to be in a loop.
Id suggest turning the code specifically (setting the cframe to camera) in this screenshot into its own function
After that make the proximity prompt do this
ProximityPrompt.Triggered:Connect(function)
ProximityPrompt.Enabled = false
-- Bind To RenderStep here
end)
You wanna put it in front of the player camera or smth?
OOPS WAIT
Turn all the code in the screenshot EXCEPT the for loop
let me edit my message real quick
Furthermore I feel like VMChair:PivotTo(Camera.CFrame)
is better for Viewmodels
OK so i fixed the Problem, all i needed was a Remote Event that Fired a Local Script in StarterPlayerScripts…
Thanks Everyone for the Help!
I see, didn’t know the problem was that deep