Ad
Log in to vote
0

Why is my billboard gui not being parented to the player?

Asked by 22 days ago

I'm trying to make a script where when the player collects a star it makes a little +1 or -1 effect emit from the player. However, nothing happens when I touch the star and there's no errors which is really odd.

This code is in a server script and is parented to StarterCharacterScripts The BillboardGuis are parented to the script

local tweenService = game:GetService("TweenService")
local debouncee = false

local tweenInfo = TweenInfo.new(0.3, Enum.EasingStyle.Quint, Enum.EasingDirection.InOut)

char = script.Parent

print(script.Parent)


local MdamageIndicatorLabel = script:WaitForChild("Minus"):Clone()
local PdamageIndicatorLabel = script:WaitForChild("Plus"):Clone()


local humanoid = char:WaitForChild("Humanoid")




script.Parent.HumanoidRootPart.Touched:Connect(function(hit)
    task.wait()
    if hit.Parent.Name == "evilstar" and debouncee == false then
        debouncee = true



        MdamageIndicatorLabel.Enabled = true
        MdamageIndicatorLabel.Parent = script.Parent.HumanoidRootPart

        MdamageIndicatorLabel:TweenSize(UDim2.new(1, 0, 1, 0), "InOut", "Quint", 0.3)


        wait(0.3)


        local textFadeTween = tweenService:Create(MdamageIndicatorLabel, tweenInfo, {TextTransparency = 1})

        textFadeTween:Play()



        wait(1)
        debouncee = false

    elseif hit.Parent.Name == "star" and debouncee == false then
        debouncee = true


        PdamageIndicatorLabel.Enabled = true
        PdamageIndicatorLabel.Parent = script.Parent.HumanoidRootPart

        PdamageIndicatorLabel:TweenSize(UDim2.new(1, 0, 1, 0), "InOut", "Quint", 0.3)


        wait(0.3)


        local textFadeTween = tweenService:Create(PdamageIndicatorLabel, tweenInfo, {TextTransparency = 1})

        textFadeTween:Play()

        wait(1)
        debouncee = false

    end
end)

Answer this question