#proximity prompts
1 messages · Page 1 of 1 (latest)
Have you read this yet? https://create.roblox.com/docs/ui/proximity-prompts
nope thanks
i didnt know abt it
is this set up right?
because it isnt working
this is the localscript i made just to test it
cant use a local script if its not in the player's character or in the player
alright
its just destroying it straight away
how can i make it only happen when the prompt is triggered
theres an example on how to code proximity prompts at the bottom of the documentation page that was sent here
it only gives an example of how to do it through the global proximitypromptservice
just replace proximitypromptservice with your proximity prompt and it works pretty sure
Are you sure? Try continuing to type it
It only works client sided
But if you want everyone to see the changes. Hook up that event to a remote
And have a server script listen and then delete the bush
Did you mean deleting the bush only works client sided? not the prompt itself?
U sure?
yeah
I meant the PromptTriggered
The prompt absolutely works across the boundary
95% of my proximity prompts in my game are server sided
so what do i do
should i just use the proximitypromptservice
Oh sorry, try Triggered not PromptTriggered
yeah that works thanks
however the bush is still just deleting itself straight away
Oh! Sorry. That event is from ProximityPromptService which is a more global way of handling prompts.
Ohh
Yeah that’s server sided my fault
i assume this code is wrong somehow
I forgot ProximityPromptService was a thing
I didn’t know that was a thing
Yes it's wrong
You have to pass a function into Connect. You're instead passing what Destroy() returns (which is nothing I think)
You can do something like
proximityprompt.Triggered:Connect(function()
bush:Destroy()
end)
instead, where we give it the function we want to run, and you destroy the bush inside that function
alright i had a feeling it would be something like that
I think it's meant to make it so you don't have to connect to every individual prompt, you can access it more globally.
For future reference: https://create.roblox.com/docs/reference/engine/classes/ProximityPromptService
(the spider is the player model) it still dont work
So you're not seeing the prompt?
yep
** You are now Level 8! **
Try unchecking RequiresLineOfSight, that can cause some issues
What's the MaxActivationDistance? Did you try increasing that?
If not that try parenting the prompt onto a part rather than the model itself
alright
yep that worked
thanks
this is a script which sets a score, and i wanna make it so the food variable increases when i eat the bush, im guessing im gonna have to rewrite this script somehow but how can i do this?
Well let the server handle the Triggered event.
When that is triggered (doing some sanity checks to ensure the player can actually eat it), add the food value to their leaderstats.
Triggered event does give you the player who triggered the event
proximityprompt.Triggered:Connect(function(playerWhoTriggered)
playerWhoTriggered.leaderstats.food.Value += 1
end)
for example
so how do i get the playerWhoTriggered
Some events automatically pass variables to the function that's connected. Triggered automatically passes playerWhoTriggered into the function for you. That's why it's a parameter in my example
ohh alright thats useful
thats so much easier than i thought itd be
thanks a lot
No problem!
is there any way to customise the actual interact button?
like not which button u press and what text it displays
like could i draw it myself and use it
I believe there is, but that's a little more complex. It's 100% possible, though.
Maybe someone else here can help you with that, otherwise there are probably YouTube videos for custom ProximityPrompts
@here sorry for the ping idk if i shld just make a new post but i wanna make a part which creates a new instance of this bush if there isnt currently one there, every 30s for example
the pictures i added show how its all set up right now, i just dont know where to go in that script