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

TweenPostion is not a valid member of TextLabel in my StarterCharacter local script?

Asked by
Nozazxe 107
3 years ago

Hello, i tried to make a local script in StarterCharacter that warns you you are about to die. but, the script has the error: 23:03:47.384 TweenPostion is not a valid member of TextLabel "Players.Nozazxe.PlayerGui.Warnings.Health"

local script:

local character = script.Parent
local humanoid = character:WaitForChild("Humanoid")
local player = game.Players:WaitForChild(character.Name)
humanoid.HealthChanged:Connect(function(health)

    if health < 30 then
        local object = player.PlayerGui.Warnings.Health
        object:TweenPostion(UDim2.new(0.271, 0, 0.75, 0))
        wait(3)
        object:TweenPostion(UDim2.new(0.271, 0, 1, 0))
    end
end)

2 answers

Log in to vote
4
Answered by
appxritixn 2235 Moderation Voter Community Moderator
3 years ago

A simple answer really. You spelled TweenPosition wrong. You spelled it "TweenPostion", missing an i in Position

local character = script.Parent
local humanoid = character:WaitForChild("Humanoid")
local player = game.Players:WaitForChild(character.Name)
humanoid.HealthChanged:Connect(function(health)

    if health < 30 then
        local object = player.PlayerGui.Warnings.Health
        object:TweenPosition(UDim2.new(0.271, 0, 0.75, 0))
        wait(3)
        object:TweenPosition(UDim2.new(0.271, 0, 1, 0))
    end
end)
0
LMAO I DIDNT KNOW Nozazxe 107 — 3y
Ad
Log in to vote
0
Answered by 3 years ago

Parts and things use Position, ui uses TweenSize!

just copy this, im pretty sure this will work

local character = script.Parent
local humanoid = character:WaitForChild("Humanoid")
local player = game.Players:WaitForChild(character.Name)
humanoid.HealthChanged:Connect(function(health)

    if health < 30 then
        local object = player.PlayerGui.Warnings.Health
        object:TweenSize(UDim2.new(0.271, 0, 0.75, 0))
        wait(3)
        object:TweenSize(UDim2.new(0.271, 0, 1, 0))
    end
end)
0
This would tween the size, not the position. appxritixn 2235 — 3y
0
i am not le script man then Jakob_Cashy 79 — 3y

Answer this question