Hello Scripters!
The code below this text is the code of a Module Script that controls the Turn-Based PVP my Bullet-Hell x Turn-Based RPG game is going to have. The issues are that I am wondering how to access the PlayerGui inside of the Module Script and how do I create attacks to enemies to after the player is done doing their turn, the enemy will do their turn and so on.
(Sorry if the code is a bit sloppy, I’m new to this kind of thing.)
local Rep = game:GetService("ReplicatedStorage")
local TurnBasedModule = {}
local Enemies = {}
function TurnBasedModule.SpawnEntity(Entity)
print("User wants to spawn "..Entity)
local mobExist = Rep.Enemies:WaitForChild(Entity)
if mobExist then
local NewEntity = mobExist:Clone()
NewEntity.HumanoidRootPart.CFrame = workspace.SpawnPoint1.CFrame
NewEntity.HumanoidRootPart.CFrame = NewEntity.HumanoidRootPart.CFrame + Vector3.new(0, 3, 0)
NewEntity.Parent = workspace
else
wait(Entity.." DOESN'T EXIST!")
end
end
return TurnBasedModule