You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? Keep it simple and clear!
I want to clone my enemy npc from serverstorage to workspace with
local Stalker = game.ServerStorage:WaitForChild("StalkerMoving"):Clone()
Stalker.Parent = game.Workspace
-
What is the issue? Include screenshots / videos if possible!
I have a script where it fires an event (replicatedstorage) when I look at the monster
RunService.RenderStepped:Connect(function()
local Vector, IsVisible = Workspace.CurrentCamera:WorldToScreenPoint(Part.Position)
local currentTime = tick()
if IsVisible and Vector.Z <= MaxDistance and (currentTime - lastPrintTime >= printCooldown) then
lastPrintTime = currentTime
print("you saw it")
Event:FireServer()
end
in the script that checks if the event is fired
Event.OnServerEvent:Connect(function()
local players = Players:GetPlayers()
for _, player in ipairs(players) do
if player.Character and player.Character:FindFirstChild("HumanoidRootPart") then
game.Workspace.StalkerMoving:Destroy()
Stalker.Parent = game.Workspace
end
end
The model gets destroyed and gets cloned once again, but when it happens for the 3rd time, it says
" The Parent property of StalkerMoving is locked, current parent: NULL, new parent Workspace"
- What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I tried using using Remove() but it removes the error comment from the output but still doesn’t clone the model. I am new to this devforum. Pls help