Is anyone able to help with creating a script that triggers when 3 players equipping specific tools are within a certain radius of each other?
TL;DR a script that works similar to the Bird Up event in Item Asylum.
Is anyone able to help with creating a script that triggers when 3 players equipping specific tools are within a certain radius of each other?
TL;DR a script that works similar to the Bird Up event in Item Asylum.
Havent played asylum, but here’s a theoretical roadmap that could accomplish your goal with some pros and cons at the end:
Script
in the ServerScriptService
LocalScript
in the Tool
objectRemoteEvent
in the ReplicatedStorage
Setup Tool.Equipped
and Tool.Unequipped
events which both call RemoteEvent:FireServer()
Setup RemoteEvent.OnServerEvent
to call a function which:
HasTag()
methodHasTag()
returns false: add a tag with the players name using AddTag
. Also need to setup a Humanoid.Died
event that removes the tag if its present to prevent tags from accumulating if players die while holdin the tool and breaking the whole system.HasTag()
returns true: remove the tag via RemoveTag()
Tags = script:GetTags()
If #Tags >= 3
then check your distance from the other characters using the Tool
by finding their Player
object via the Tags
table which has their name in it and then using DistanceFromCharacter()
to check distances. If all distances are within the limit then
> Do whatever it is that happens when the conditions are met
.
Otherwise:
> Do nothing
If #Tags < 3
then do nothing
So basically whats going on is the script is keeping track of who has this tool equipped by adding their names as an instance tag to the script object. When you equip the tool, the tag doesnt exist yet, therefore HasTag returns false, and adds your name as a tag. When you unequip the tool, HasTag will return true and remove your tag. Regardless of the action, next we get an updated table of the current tags and if theres at least three users then we check the distance between their characters. If this distance is within limit, then do whatever special thing it is thats supposed to happen - Pull_The_Lever_Kronk.exe
Alright, thanks for helping.
30 words needed
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.