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

My Star shakes uncontrollably?...

Asked by
epicnt 13
4 years ago

I'm making a spell of some sort, basically a star that lingers on your side for 10 seconds and dissapears unless you point it at someone, where it will home on that person till it hits them

But all it does is shake uncontrollably(haven't completed the homing part, but I have done the hover part)

My code:

local Stella = script.Parent
local plr = game.Players.LocalPlayer
local bruh = true
local m = plr:GetMouse()

local speed = 50

local anim = Instance.new("Animation")
anim.AnimationId = "rbxassetid://5156190355"

Stella.Activated:Connect(function() 
    if plr.Stats.Mana.Value > 20 then
    if plr.Stats.Mana.Value >= 60 and plr.Stats.Mana.Value <= 75 then   
        local animTrack = plr.Character.Humanoid:LoadAnimation(anim)
        animTrack:Play()
        wait(1)
        animTrack:Stop()

        local Star = Instance.new("Part", workspace)
        Star.Name = "Stella"
        Star.Material = "Neon"
        Star.Color = Color3.fromRGB(255,255,0)
        Star.Size = Vector3.new(3,3,3)
        Star.Anchored = false       
        Star.Orientation = plr.Character:FindFirstChild("Right Arm").Orientation
        Star.CFrame = plr.Character:FindFirstChild("Right Arm").CFrame * CFrame.new(-1.5,2,-5)

        print("Stella Torque has been casted by "..plr.Name)

        plr.Stats.Mana.Value = plr.Stats.Mana.Value - 20

        local z = 0 

        while wait() do
        if z == 125 then
        Star:Destroy()
        elseif z < 125 then
        Star.CFrame = CFrame.new(0,2,-5)* plr.Character:FindFirstChild("Right Arm").CFrame 
        z = z + 1   
        end
        end

    elseif plr.Stats.Mana.Value < 60 or plr.Stats.Mana.Value > 75 then
        print("Stella Torque has been backfired by "..plr.Name)

        if plr.Character.Humanoid.Health > 35 then 
        plr.Character.Humanoid.Health = plr.Character.Humanoid.Health - 20

        elseif plr.Character.Humanoid.Health < 35 then
        plr.Character.Humanoid.Health = 3

            end
        end
    end
end)

Thanks, in advance!

1 answer

Log in to vote
0
Answered by 4 years ago

try setting speed to like 5-10

Ad

Answer this question