I've been learning Roblox this week, and ran into some confusion.
1.) Enemies should spawn from the server on all clients
2.) Enemies should run some code (movement, etc)
3.) ...
4.) Profit
Here's some pseudo-ish code I have:
--Script under ServerScriptService local storage = game:GetService("ReplicatedStorage") local enemy = storage:FindFirstChild("Enemy"):Clone() enemy.Parent = game.Workspace
And just a bit more:
--Script on my 'Enemy' local humanoid = script.Parent:FindFirstChild("Humanoid") (...) humanoid.MoveTo(some location)
(Assume the above all compiles and runs - it's not directly from my project)
What I want (and am not getting) is to have my server script spawn an enemy from ReplicatedStorage when needed for all clients, and for said enemy to run some code. In my case, the enemy spawns but the code does not run. I have FE on, but I was unaware if this had any affect since it's server code, not client.
If you can clear up my confusion and/or suggest a better or more proper way to handle such a task, please let me know at least the basics!
Thanks
Its hard to hit this problem specifically but to kindof sum it up for you. You want to have either a Remote Event or Remote Function that says an Enemy Was Spawned which, can then be forwarded to create a state that can be used as a conditional to run the code. An example would be Calling a RemoteEvent/Function in a server script broadcasting to spawn an enemy and then in the enemy script checking for the broadcast from the RemoteEvent/Function to run the code you want it to run.
If youre still having trouble DM me and ill help you 1 on 1
Figured out the problem, I am using Team Create, and my Enemy script is a linked script, which somehow was broken. Added a new script, cut and pasted my code, and it is now working