String Value doesnt change with the script

the value is walkset
“Thanks for taking your time to help me! Pleas ask questions if you need.”

local char = script.Parent
    local Humanoid = char:FindFirstChild("Humanoid")
    local walkset = script.Value.Value
    while true do
    	wait()
    	if Humanoid then	
    		if Humanoid.FloorMaterial == Enum.Material.Grass or Humanoid.FloorMaterial == Enum.Material.LeafyGrass then
    			walkset = "rbxassetid://252965149"
    			print(char.name)


    		end
    		if Humanoid.FloorMaterial == Enum.Material.Concrete or Humanoid.FloorMaterial == Enum.Material.Slate or Humanoid.FloorMaterial == Enum.Material.Pavement then
    			walkset = "rbxassetid://7085292903"
    			
    			
    			

    			
    		end
    	end
    end

boolvalues are true/false
use a stringvalue for strings
also, don’t define the value itself, rather, define the instance and change the value with something like
walkset.Value = "example"

There are a few things not quite right in your script

  • You can’t assign a string to a BoolValue
    • Solution: Remove the existing value, and add a StringValue
  • You cannot change values like that
    • When you change a variable like so, you’re changing what the variable walkset refers to, forgetting about script.Value.Value
    • Solution: Change your code like so
local char = script.Parent
local Humanoid = char:FindFirstChild("Humanoid")
local walkset = script.Value  -- see this line change
while true do
    wait()
    if Humanoid then
        if Humanoid.FloorMaterial == Enum.Material.Grass or Humanoid.FloorMaterial == Enum.Material.LeafyGrass then
            walkset.Value = "rbxassetid://252965149"  -- see this line change
            print(char.name)
        end
        if
            Humanoid.FloorMaterial == Enum.Material.Concrete or Humanoid.FloorMaterial == Enum.Material.Slate or
                Humanoid.FloorMaterial == Enum.Material.Pavement
         then
            walkset.Value = "rbxassetid://7085292903" -- see this line change
        end
    end
end

  • You don’t seem to be doing anything with the value applied to walkset. Is there another script accessing walkset?
1 Like

i am soo sory i ment to say String value

i am soo sory i ment to say String value

yes there is another script connected to this