How to execute a script from a local Part

Hi! :3 I’m trying to run scripts inside local parts in my game. But they never work, not mattering if I use a local script or a normal one.

What’s inside each script

--Variables
lightPart = script.Parent

while true do
	print("-----------------------------------------")
	wait(0.05)
end

Project Structure:

This is how the Workspace looks when looking inside the Local Player while playing.

Thanks :3

Localscripts don’t work if they are a descendant of workspace and not parented by a player character model at the same time.

Thanks for the answer :3
I have an entire city (that’s anchored) in Local Workspace, do you know if there would be any problems with Parenting it to the player character model if it dies?

Well if the character dies, the city will be destroyed too.

1 Like

Big OOF, I’ll need to rework some things

you’ll be able to run the script from other places such as playergui, startercharacter/playerscripts and so on.

1 Like

Thanks :3 I already rebuilt it and it’s rockin now :stuck_out_tongue:

2 Likes