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

This floats me away to heaven..?

Asked by 8 years ago

So I am making an admin script, and all of them are good except for the shield. When the player chats "shield on" it will make a bubble shield around them. The thing is, when the shield turns on, it floats them away into heaven. Does anyone know how to stop that from happening? Btw, its part of a player.chatted function.

healthCanBeGenerated = false
workspacePlayer = game.Workspace.DJwaffle2005


if msg == "shield on" then
        print("Turned on shield.")
        shield = Instance.new("Part",workspacePlayer.Torso)
        shield.BrickColor = BrickColor.new("Toothpaste")
        shield.Shape = "Ball"
        shield.Material = "Marble"
        shield.Anchored = true
        shield.Transparency = 0.5
        shield.Size = Vector3.new(24, 24, 24)
        while true do
            healthCanBeGenerated = true
            local x = workspacePlayer.Torso.Position.X
            local y = workspacePlayer.Torso.Position.Y
            local z = workspacePlayer.Torso.Position.Z
            wait(0.1)
            if healthCanBeGenerated == true then
                workspacePlayer.Humanoid.Health = workspacePlayer.Humanoid.Health + 100000000000000
            end
            shield.CFrame = CFrame.new(x,y-1,z-1.5)
        end
    end

    if msg == "shield off" then
        print("Shield has been turned off.")
        shield:Destroy()
        healthCanBeGenerated = false

Answer this question