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

Filtering Enabled Script working in studio but not in game?

I'm new to Filtering Enabled and I'm running into some problems The problem is the code won't work on the client. I've tried using local scripts but then Remote Events don;t work.

code 1

script.Parent.MouseClick:connect(function()
	game:GetService("ReplicatedStorage").OnEat:FireServer()
end)

code 2

game.ReplicatedStorage.OnEat.OnServerEvent:connect(function(Player)
	local Character = Player.Character
	local Humanoid = Character.Humanoid
	local BDS = Humanoid.BodyDepthScale
	local BHS = Humanoid.BodyHeightScale
	local BWS = Humanoid.BodyWidthScale
	local HS = Humanoid.HeadScale
	local points = game.Players.LocalPlayer.leaderstats.Points
	local rebirth = game.Players.LocalPlayer.leaderstats.Rebirth	
	
	BDS.Value = BDS.Value +0.03*rebirth.Value
	BHS.Value = BHS.Value +0.03*rebirth.Value
	BWS.Value = BWS.Value +0.03*rebirth.Value
	HS.Value = HS.Value +0.03*rebirth.Value
	Humanoid.WalkSpeed = Humanoid.WalkSpeed + 0.03 
	points.Value = points.Value +1*rebirth.Value

end)

1 answer

Ugh, I've ran into countless problems like this FE. It would be nice if you could give me more information of what your script does and where the scripts are located but anyway...

You're using a remote event. The FireServer event works only from a local script to a global script. I'm assuming the first script is local. I don't know whether you're trying to do something with a GUI but if it's fired on a MouseClick event I'm assuming it's using a ClickDetector and it's in workspace. So I suggest making that global, but correct me if I'm wrong.

However the main issue I believe is LocalPlayer in your second script. As I mentioned before FireServer can only be fired from client to server (from local script to global script). And LocalPlayer doesn't work in global scripts. Only local scripts can access LocalPlayer. So to make this work you should change the second script to a local script and use the OnClientEvent in the local script, and FireClient on the global one.

Sorry if this wasn't much help or if it was confusing. As I said I don't exactly know what you're trying to do here and where the scripts are located, but if you could tell me I will try my best to help you.

2 comments

0

Okay

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