I'm trying to learn how to use FilteringEnabled and I have looked on the wiki and I have found you needed to use http://wiki.roblox.com/index.php?title=RemoteEvent .. But it just provides information but no examples on how I would use it. I know there is another one that gives a very 'brief' example and it isn't enough for me to edit the scripts that I have and make them work correctly..
This is a script that breaks when I put FilteringEnabled true. I'm not asking for someone to do it for me, but to explain a bit more in depth of how I would use Remote Events make this work..
repeat wait()until game.Players.LocalPlayer wait(1) plr=game:service("Players").LocalPlayer repeat wait()until plr:FindFirstChild("leaderstats") repeat wait()until plr.Character~=nil ar=plr.leaderstats:FindFirstChild("Armor") pl=plr.Character:FindFirstChild("Humanoid") if ar~=nil then pl.MaxHealth=ar.Value + 100 pl.Health=ar.Value + 100 end
Sorry forgot where it's located.. If you couldn't already figure it out from the first line.. But it's in a Local Script located within StarterGUi
There is actually a wiki page that explains how to do this quite nicely! You can find it here.
This page teaches you how and when to use both RemoteEvents and RemoteFunctions, it's worth the read!
EDITS
Here is how I would approach your exact problem. First we are going to need two separate scripts, one a regular server Script and the other a LocalScript. Inside the ServerScript, we are going to need to create the RemoteEvent, set our variables and leaderstats, and declare what to do when the the ServerEvent is called.
local event = Instance.new('RemoteEvent', game.Workspace) event.Name = 'SetHealth' game.Players.PlayerAdded:connect(function(player) local leaderstats = Instance.new("Model", player) leaderstats.Name = "leaderstats" local armor = Instance.new("IntValue", leaderstats) armor.Name = "Armor" armor.Value = 15 event.OnServerEvent:connect(function() player.Character.Humanoid.MaxHealth = player.leaderstats.Armor.Value + 100 player.Character.Humanoid.Health = player.leaderstats.Armor.Value + 100 end) end)
Next, in the LocalScript (put in StarterGui or StarterPack), we are going to need to declare when we want the Event to actually happen.
repeat wait() until game.Players.LocalPlayer.Character repeat wait() until game.Players.LocalPlayer:FindFirstChild('leaderstats') repeat wait() until game.Players.LocalPlayer.leaderstats:FindFirstChild('Armor') game.Workspace.SetHealth:FireServer() -- Because the LocalScript is inserted every time you spawn, we don't need to use a CharacterAdded method game.Players.LocalPlayer.leaderstats.Armor.Changed:connect(function() -- Make sure that the health updates as armour gets stronger game.Workspace.SetHealth:FireServer() end)
And VoilĂ ! Your RemoteEvent is set up and ready to use.