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

Is this script correct, if not, how do I fix it?

Asked by 10 years ago
     ----game.StarterGui.MaskGUI.Visor.Visible -----

    wait(10)

    if game.StarterGui.MaskGUI.Visor.Visible == true then
    workspace.EnemyTest.CFrame.new(13, 0.5, 49.6)

else  
    p = game.Players:GetChildren()
   for i = 1,#p do
   p[i].Character.Head:remove() 

   end

   end

This is a test enemy code for FNAF 2. What this means, is, if an animatronic is in the room, then it waits 10 seconds, if the mask gui image is visible, then the animatronic teleports away to a certain location. If the mask is not on by then, it will kill all players. However, everytime, it seems to kill me, even when the mask is visible and on. If you need the screen gui, I can also show you that, but can anyone help me with this?

0
Just a tip, CFrame uses Angles rather the position. MessorAdmin 598 — 10y

2 answers

Log in to vote
0
Answered by 10 years ago

Line 6 should be erroring.

workspace.EnemyTest.CFrame = CFrame.new(13, 0.5, 49.6)
Ad
Log in to vote
-1
Answered by
IcyEvil 260 Moderation Voter
10 years ago
----game.StarterGui.MaskGUI.Visor.Visible -----
wait(10)
if game.StarterGui.MaskGUI.Visor.Visible == true then
game.Workspace.EnemyTest.CFrame.new(13, 0.5, 49.6)-- if you use workspace, it Will not work, you need to either use Workspace or game.Workspace
else  
p = game.Players:GetChildren()
for i = 1,#p do
p[i].Character.Head:Destroy() --Remove Does not work with Some things, Destroy() should work Most of the time.
end
end

Thats should Cover it Really.

If it still doesn't work tell me.

Answer this question