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

What's a UserData Value and how I fix it?

Asked by 9 years ago

I was trying to use a event called InterpolationFinished but I got a error,how do I fix it,and what does it mean?

Output: Workspace.Player1.Right Leg.LocalScript:9: attempt to call method 'InterpolationFinished' (a userdata value)

Script that gives the LocalScript:

local Part = script.Parent.Part
local Touched = false
--------------------------
    Part.Touched:connect(function(Player)
        Touched = true
            if  not Touched
                then
                Wait(5)
                Touched = false
                else
                    for _,Scripts in pairs (script:GetChildren()) do
                        Cloned = Scripts:Clone()
                        Cloned.Parent = Player
                        Cloned.Disabled = false
            end
        end
    end)

LocalScript:

local Player = game.Players.LocalPlayer
local Character = Player.Character
local Camera = game.Workspace.CurrentCamera
local Part = game.Workspace.Model.Part
local Part1 = game.Workspace.Model.Part1
-------------------------------------------
    Camera.CameraType = "Scriptable"
    Camera:Interpolate(CFrame.new(Part.CFrame.lookVector), CFrame.new(Part.CFrame.p),1)
    Camera.InterpolationFinished:connect(function()
    Camera.CameraSubject = Part
    Camera.CameraType = "Attach"
    end)

1 answer

Log in to vote
4
Answered by
BlueTaslem 18071 Moderation Voter Administrator Community Moderator Super Administrator
9 years ago

userdata is a C object that Lua has access to.

This means it's something that the underlying engine (i.e., ROBLOX) has created.

userdata includes Vector3, CFrame, BrickColor, and all Instances.


Because of this, errors involving userdata aren't usually very helpful.


In this case though, I don't see how this error could be triggered by this code. You aren't calling "InterpolationFinished" so I don't see the problem.

0
How can I call it? kevinnight45 550 — 9y
0
No, you shouldn't be calling it; the error says you attempted to but I don't see that expressed in this snippet BlueTaslem 18071 — 9y
0
So is there a way to fix it? kevinnight45 550 — 9y
2
Try adding a wait() after you call Interpolate. As long as the user's computer isn't lagging to he point of crashing, it will let the event connect before the interpolation finishes, although this error shouldn't be occurring in the first place. adark 5487 — 9y
View all comments (2 more)
0
Thanks it worked! kevinnight45 550 — 9y
0
You should be using Color3 as of 2020's updates not Vector3 SirWooff 0 — 4y
Ad

Answer this question