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

Value doesnt wanna update?

Asked by
Ludzik78 136
3 years ago

Im currently making a power based game and i have trouble with one thing, that is that the TotalPower doesnt wanna update. My code:

local TargetPart = script.Parent.Parent.TargetPart
local req = 1e+12
script.Parent.Touched:Connect(function(hit)
    if hit.Parent:FindFirstChild("Humanoid") then
        local player = game.Players:GetPlayerFromCharacter(hit.Parent)
        local stats = player.Stats
        local TP = player.ExtraData.TotalPower
        local HumRP = player.Character.HumanoidRootPart
        print(TP.Value)
        if TP.Value >= 1e+12 then --Game thinks TP is 0 while it is more
            HumRP.CFrame = TargetPart.CFrame
        end
    end
end)

Things i've tried: Print debugging (Keeps saying TP is 0) Manually going to the path

1
Make sure to update the TP in a script and not a local Script, so it actually updates. esepek 103 — 3y
0
It is in a script tho. Ludzik78 136 — 3y
0
Oh wait. Ludzik78 136 — 3y

Answer this question