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
01     ----game.StarterGui.MaskGUI.Visor.Visible -----
02 
03    wait(10)
04 
05    if game.StarterGui.MaskGUI.Visor.Visible == true then
06    workspace.EnemyTest.CFrame.new(13, 0.5, 49.6)
07 
08else 
09    p = game.Players:GetChildren()
10   for i = 1,#p do
11   p[i].Character.Head:remove()
12 
13   end
14 
15   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.

1workspace.EnemyTest.CFrame = CFrame.new(13, 0.5, 49.6)
Ad
Log in to vote
-1
Answered by
IcyEvil 260 Moderation Voter
10 years ago
01----game.StarterGui.MaskGUI.Visor.Visible -----
02wait(10)
03if game.StarterGui.MaskGUI.Visor.Visible == true then
04game.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
05else 
06p = game.Players:GetChildren()
07for i = 1,#p do
08p[i].Character.Head:Destroy() --Remove Does not work with Some things, Destroy() should work Most of the time.
09end
10end

Thats should Cover it Really.

If it still doesn't work tell me.

Answer this question