I want to do the next thing. When you have "Objects" (Stat) in value = 5 ,you need to be teleported, i use the next script,but it doesnt works. Whats the problem?
Position=Vector3.new(-46.078, 5.046, -1105.82) objects.Changed:Connect(function() if objects.Value == 5 then local objects = Instance.new("IntValue", stats) FindFirstChild("Humanoid") then Torso.CFrame=CFrame.new(Position) end end)
local pos = Vector3.new(-46.078, 5.046, -1105.82) local stats = game.Players.LocalPlayer.leaderstats -- define as stats local objects = Instance.new("IntValue", stats) local char = game.Players.LocalPlayer.Character local tor = char:WaitForChild("Torso") -- r15 "UpperTorso" objects.Changed:Connect(function() if objects.Value == 5 then tor.CFrame=CFrame.new(pos) else print("Objects value isn't 5") end end)
You didn't define stats and you defined objects later on in the change functions so it returned the function as nil.
And you didn't define the torso...
Next time please give full code..