Ad
Log in to vote
0

Force Field won't go away to fight?

Asked by 3 days ago

I want to make a game where you spawn in with a shield (So you don't get spawn killed), but when the timer gets down and you get tp'd into the game(A part, which you cannot see/touch, but it is really on a GrassPlate).

Script that puts you in the game:

local seconds = game.Workspace.Time
local ingame = game.Workspace.InGame.Value
local Game = game.Workspace.Game.Position


while true do

    wait(1)
    seconds.Value = seconds.Value - 1

    if seconds.Value == 0 and ingame == 0 then

        ingame = 1
        seconds.Value = 30

        local teleport = game.Players:GetChildren()
        for i = 1, #teleport do
            teleport[i].Character:MoveTo(Vector3.new(Game.X, Game.Y, Game.Z))

        end
    end

    if seconds.Value == 0 and ingame == 1 then

        ingame = 0
        seconds.Value = 15

        local teleport = game.Players:GetChildren()
        for i = 1, #teleport do
            teleport[i]:LoadCharacter()

        end
    end


end

I have a script in ServerScriptService that gives you a infinite Force Field that is this:

game.Players.PlayerAdded:Connect(function(player)
    player.CharacterAdded:Connect(function(character)
        local ff = Instance.new("ForceField")
        ff.Parent = character
    end)
end)

Here is the script in the GrassPlate that is supposed to make the Force Field go away:

script.Parent.Touched:Connect(function()
    game.Workspace.Parent.ServerScriptService.CoolScript.Disabled = true
end)

Why does nothing happen? Please help me. Thank you!

0
nvm the infinite Force Field does not work when you die so help me on that to thanks kickoff127 10 — 3d
0
I also want it to loop like that forever kickoff127 10 — 3d

1 answer

Log in to vote
0
Answered by 3 days ago

Disabling the script won't make the force field go away. You need to delete it;

It does not work when you die because the script is disabled.

0
But that wont loop it... kickoff127 10 — 3d
0
And it did not work. kickoff127 10 — 3d
0
It's an event so that code will be ran everytime the event is fired! So everytime the character spawns, the code should run aurich98 86 — 2d
Ad

Answer this question