So I’m planning on making a detection script but theirs a problem with the bool value. I have it set up we’re if the bool is true the platformstand in the character is triggered. But nothing is happenening when I true the value. Please help.
local Character = script.Parent
local Humanoid = Character.Humanoid
local RootPart = Character.HumanoidRootPart
local Value = script.onGround
Value.Changed:Connect(function()
if Value then Humanoid.PlatformStand = true else Humanoid.PlatformStand = false end
end)
This wouldn’t fix his solution because the Value variable is meant to reference the actual ValueBase object (you can assume that because the next line is Value.Changed)
Try this instead:
local Character = script.Parent
local Humanoid = Character.Humanoid
local RootPart = Character.HumanoidRootPart
local onGround = script.onGround
onGround.Changed:Connect(function(newValue)
if newValue then
Humanoid.PlatformStand = true
else
Humanoid.PlatformStand = false
end
end)
Edit: You can actually optimize this because of how you’re using the onGround bool. The function could just be this:
Ohhh my bad, i shud prob read the whole script in such cases. So @anxlr ur solution is @NoParameters post. The reason is because ur checking the original value not the changed one.
local Character = script.Parent
local Humanoid = Character.Humanoid
local RootPart = Character.HumanoidRootPart
local Value = script.onGround
Value.Changed:Connect(function()
Humanoid.PlatformStand = Value.Value -- Adding a property to read the value. Should work assuming that you synchronize values.
end)
Try changing it on the server and see if that alters the result. After hitting play solo, go to Home → Test and click "Current: Client" to switch it over to the Server. Then, try changing the bool value.
local Character = script.Parent
local Humanoid = Character.Humanoid
local RootPart = Character.HumanoidRootPart
local Value = script:WaitForChild('onGround')
Value.Changed:Connect(function()
Humanoid.PlatformStand = Value.Value -- Adding a property to read the value. Should work assuming that you synchronize values.
end)