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

Drinking script will not play animation and sound/Work?

Asked by 4 years ago
Edited 4 years ago

im using a bloxy cola script, but with some changes to it, but i dont know where ive gone wrong.

script:

local Tool = script.Parent;
local Hum = Tool.Parent.Parent.Humanoid;
local Anim = Hum:LoadAnimation(script.Parent.drink);

enabled = true




function onActivated()
    if not enabled  then
        return
    end

    enabled = false
    Tool.GripForward = Vector3.new(-0.381, -0.752, -0.537)
    Tool.GripPos = Vector3.new(1.268, -0.688, -0.83)
    Tool.GripRight = Vector3.new(0.818, -0.003, -0.576)
    Tool.GripUp = Vector3.new(-0.431, 0.659, -0.617)


    Tool.Handle.DrinkSound:Play()
    Anim:Play()
    wait(1.3)
    Tool.Handle.DrinkSound:Stop()
    wait(1)
    Tool.Handle.DrinkSound:Play()
    Anim:Play()
    wait(1.3)
    Tool.Handle.DrinkSound:Stop()
    wait(1)
    Tool.Handle.DrinkSound:Play()
    Anim:Play()
    wait(1.3)
    Tool.Handle.DrinkSound:Stop()



    local h = Tool.Parent:FindFirstChild("Humanoid")
    if (h ~= nil) then
        if (h.MaxHealth > h.Health + 5) then
            h.Health = h.Health + 5
        else    
            h.Health = h.MaxHealth
        end
    end
    Tool.GripForward = Vector3.new(-0.999, 0.034, 0.005)
    Tool.GripPos = Vector3.new(0.188, -0.046, -0.076)
    Tool.GripRight = Vector3.new(-0.005, 0.001, -1)
    Tool.GripUp = Vector3.new(0.034, 0.999, 0)
wait(2)
script.Parent:Destroy()

    enabled = true

end

function onEquipped()
    Tool.Handle.OpenSound:play()

end

script.Parent.Activated:connect(onActivated)
script.Parent.Equipped:connect(onEquipped)
0
Are there no errors? Psudar 882 — 4y
0
Oh and lmao, you can use Animation.Completed:Wait() instead of hardcoding the wait() functions Psudar 882 — 4y
0
14:05:31.830 - Players.Bylli_Oruze.Backpack.NeroJuice.BloxyColaScript:2: attempt to index local 'Player' (a nil value) Bylli_Oruze 38 — 4y
0
Well my sir, there appears to be no mention of any player variable in the script you shared. Its not even being indexed. That error must be from a different script, or you accidentally sent the wrong one. Psudar 882 — 4y
View all comments (3 more)
0
there arent any errors then, but the tool still doesnt work for some reason Bylli_Oruze 38 — 4y
0
You should print out some values to find where its failing. Also, try using the debugger window if its that serious. ShashMouthDZX 15 — 4y
0
should line 59 be Play() not play() (captials) Spiritlotus 151 — 4y

Answer this question