Localscript wont play

it just wont work for some reason it wont print or anything

local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()

local Value = Character:WaitForChild("IsSlowed")

local SlowData = game.ReplicatedStorage.SlowData

	
--it works all up until value changed
Value.Changed:Connect(function(NewValue)
	print(NewValue)
end)

And the script is located in starter character scripts

1 Like

Try changing the value manually. It should print out a number.

Also, change the 2nd line to local Character = script.Parent

When I change it manually it works but not when it gets changed wtih a script

Actually I think changing that one line fixed it

Does it actually change the value in the other script?

Okay so manually changing it works but the script just wont change the walkspeed. It will print whats past the walkspeed and the new value but it just wont slow the person

Is it supposed to change the speed here?

I changed the script some I put a remote event in instead and it just wont fire it


local Player = game.Players.LocalPlayer
local Character = script.Parent

local Value = Character:WaitForChild("IsSlowed")

local Humanoid = Character:WaitForChild("Humanoid")

local SlowData = game.ReplicatedStorage.StuckEnemy

Value.Changed:Connect(function(NewValue)
	print(NewValue)

	if NewValue == true then
		SlowData:FireServer(NewValue)
		print('hi')
	else
		
		warn("Test")
		SlowData:FireServer(NewValue)
	end

end)

What is the server script doing when it connects to the remote event?

it just prints the new value

local SlowData = game.ReplicatedStorage.StuckEnemy

SlowData.OnServerEvent:Connect(function(NewValue)
	warn(NewValue)
	
end)

But it never prints anything or throws a error so idk whats wrong

Try changing that to OnClientEvent and make it plr, NewValue instead.

Ok so in the end I kinda fixed it it was mostly beacuse of another script interfering with it

it will print value when changed. but at first place, iā€™s not changed.
you need do this:

Value.Changed:Connect(function(NewValue)
	print(NewValue)
end)
print(NewValue)

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.