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

How do I remove the player's force field? [ANSWERED] [closed]

Asked by 7 years ago
Edited 7 years ago

How do I remove the player's force field without breaking when the player doesn't have a force field?

local animation = Instance.new('Animation')
local animTrack
local debounce = false
local player = game.Players.LocalPlayer.Character

function onEquip()
   script.Parent.Handle.UnsheathSound:Play()
end

function onActivate()
    if not debounce then
    debounce = true
    player.ForceField:Destroy()
    animation.AnimationId = "http://www.roblox.com/asset/?id=129967390"
    animTrack = player.Humanoid:LoadAnimation(animation)
    animTrack:Play()
    script.Parent.Handle.SlashSound:Play()
    script.Parent.Handle.Script.Disabled = false
    wait(0.5)
    animTrack:Stop()
    script.Parent.Handle.Script.Disabled = true
    wait(0.5)
    debounce = false
    end
end

function onUnequip()
    animTrack:Stop()
end

script.Parent.Equipped:connect(onEquip)
script.Parent.Unequipped:connect(onUnequip)
script.Parent.Activated:connect(onActivate)
0
Just check if he has a forcefield before you go and try to remove one. Do if player:FindFirstChild('ForceField') then player.ForceField:Destroy() end M39a9am3R 3210 — 7y
0
Thanks it works! GatitosMansion 187 — 7y
0
you don't need a script to do that 7zjh 146 — 4y

Locked by JesseSong

This question has been locked to preserve its current state and prevent spam and unwanted comments and answers.

Why was this question closed?

1 answer

Log in to vote
3
Answered by 7 years ago

Even though you already got your answer, a WAY easier way you could disable the Force Field without using scripts is to go to the SpawnLocation Properties and change the Force Field Duration to 0

0
Assuming you are using a spawn location Part ragingskull182 67 — 7y
0
Real useful man Tymberlejk 143 — 5y
Ad