game.Workspace.Value.Value.Changed:Connect(function() local b = game.Players.LocalPlayer:WaitForChild("Character") b.HumanoidRootPart.Anchored = false print("Unchored") end)
So there are a few things id like to point out
Errors
.1 as kanyeweasftd said, the b between character and hrp.
.2 your trying to index a the number VALUE with Changed, you dont do that, you have to connect .Changed with the instance not the value, do this:
game.Workspace.Value.Changed:Connnect(function() end)
Tips to make your code look better
Variables
Start using more variables your code is very messy.
Non sense
Why are you waiting for child character? Do this instead
local Players = game:GetService("Players") local Player = game.Players.LocalPLayer local Character = Player.Character or Player.CharacterAdded:Wait()
Functions Using local functions there would make your code better, something like this
local function OnValueChange(NewValue) --your code end Value.Changed:Connect(OnValueChange)
Comments Its always good to make yourself a "comment template"
--// Services --// Librarys --// Constants --// Functions
@CaioAlpaca I have Tried 2 scripts first one being
game.Workspace.Value.Changed:Connect(function() local Players = game:GetService("Players") local Player = game.Players.LocalPLayer local Character = Player.Character or Player.CharacterAdded:Wait() Character.HumanoidRootPart.Anchored = false print("Unchored") end)
Second one being
local function OnValueChange(NewValue) local Players = game:GetService("Players") local Player = game.Players.LocalPLayer local Character = Player.Character or Player.CharacterAdded:Wait() Character.HumanoidRootPart.Anchored = false print("Unchored") end game.Workspace.Value.Changed:Connect(OnValueChange)
These Have Both failed