Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How can I have a part specific local script attached to a part?

Asked by 5 years ago

The question is confusing, I know. Let me clarify what I mean.

I have a script that fires a remote event to a local script parented to the playerscript that triggers an npc dialog. The problem is that I want certain special functions to occur during the dialog so I have control over the cinematography of the dialog, i.e. move the camera, or such.

In order to do this I figured to have an array of strings and objects, which are all bindable events.

For example inside of the npc dialog server script this array is inside


local Lines = { "HELLO THERE", "WOULD YOU LIKE AN APPLE", script.Parent.giveApple, -- This is an event object that will fire a client that will trigger a function which gives the player it is talking to an apple object "THERE YOU GO" }

And there is a local script reading through each item in the array, when it comes across an object array it will Fire that event, this isn't a RemoteEvent because it is communicating between local scripts. The problem is that I want the script of the function being fired to be parented to the part, which cannot be done because the local script is in the workspace.

The reason I want the local function script to be attached to a part is for organization, I don't want to make a confusing situation where in the process of debugging I have to go through different local scripts in different hierarchy and make a mistake in another code by accident. I want the scripts to be isolated in one section and not inside the character or the local player.

So is there a way to move the local script elsewhere, such as the local player, without losing this organization?

Hopefully what I am asking is clear

tl;dr, I want to have a local script attached to a part so I can perform a client only function. Am I able to change the hierarchy of the local script for it to work?

0
Just do `local part = workspace.Part` not hard User#24403 69 — 5y
0
I don't understand how this answers my question guestnot99 112 — 5y

Answer this question