Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Why wont my script wont detect change in a Bool Value?

local StarterGui = game:GetService("StarterGui")
local FartButton = StarterGui:WaitForChild("FartButton")
local character = script.Parent
local KillAnim = script:WaitForChild("FartAnim")
local Torso = script.Parent:WaitForChild("LowerTorso")
local UserInputService = game:GetService("UserInputService")
local emitter = Torso:WaitForChild("ParticleEmitter")
local humanoid = character:WaitForChild("Humanoid")
local KillAnimTrack = humanoid.Animator:LoadAnimation(KillAnim)
local sound = script:WaitForChild("FartSound")
local Head = script.Parent:WaitForChild("Head")
local Neutral = Head:WaitForChild("face")
local Grit = Head:WaitForChild("face2")


local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Fart = ReplicatedStorage:WaitForChild("Fart")
local FartVal = Fart.Value


while true do
	if FartVal == true then
		print("Fart was Pressed!")
		Neutral.Transparency = 1
		Grit.Transparency = 0
		emitter.Rate = 8
		humanoid.JumpPower = 200
		humanoid.WalkSpeed = 34
		KillAnimTrack:Play()
		sound:Play()
		wait(2)
		humanoid.WalkSpeed = 16
		humanoid.JumpPower = 50
		emitter.Rate = 0
		Neutral.Transparency = 0
		Grit.Transparency = 1
	end
end

I was wondering if i could get some help with this.

(I've also tried using ":GetPropertyChangedSignal" and it still doesn't work.)

2 comments

0

All the contents of StarterGui are replicated into PlayerGui located in the client's player object this applies to all starter services

0

changing things in StarterGui, Starterpack, StarterPlayer, StarterCharacterScripts and StarterPlayerScripts will do nothing

2 answers

you cant put FartVal as a variable...

u kinda have to do if Fart.Value == true then ....

1 comment

0

Still doesn't seem to work, are there any other solutions you know of?

It seems that "GetPropertyChangedSignal" worked for this, i was just doing it wrong.

local StarterGui = game:GetService("StarterGui")
local character = script.Parent
local KillAnim = script:WaitForChild("FartAnim")
local Torso = script.Parent:WaitForChild("LowerTorso")
local UserInputService = game:GetService("UserInputService")
local emitter = Torso:WaitForChild("ParticleEmitter")
local humanoid = character:WaitForChild("Humanoid")
local KillAnimTrack = humanoid.Animator:LoadAnimation(KillAnim)
local sound = script:WaitForChild("FartSound")
local Head = script.Parent:WaitForChild("Head")
local Neutral = Head:WaitForChild("face")
local Grit = Head:WaitForChild("face2")


local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Fart = ReplicatedStorage:WaitForChild("Fart")

Fart:GetPropertyChangedSignal("Value"):Connect(function()
	
	if Fart.Value == true then
		Fart.Value = false
		Neutral.Transparency = 1
		Grit.Transparency = 0
		emitter.Rate = 8
		humanoid.JumpPower = 200
		humanoid.WalkSpeed = 34
		KillAnimTrack:Play()
		sound:Play()
		wait(2)
		humanoid.WalkSpeed = 16
		humanoid.JumpPower = 50
		emitter.Rate = 0
		Neutral.Transparency = 0
		Grit.Transparency = 1
	end
			
end)

This discussion is preserved as it was. New answers, comments, and votes are closed.