With the new filtering enabled update, a lot of my scripts where broken and I'm trying to fix them all.
One tool I have is run completely by 1 Local Script. One part I'm working on now gave the player an aura (basically just welded an invisible particle emitting part to the character's torso) when a tool is equipped. This is how my LocalScript looked before.
plr = game.Players.LocalPlayer repeat wait() until plr.Character ~= nil char = plr.Character tool = script.Parent mouse = plr:GetMouse() aura = tool.aura function Equip() stage = 1 aura.Anchored = false local weld = Instance.new("Weld") aura.CFrame = char.Torso.CFrame weld.Parent = aura weld.Name = "BackWeld" weld.Part0 = char.Torso weld.Part1 = aura whirl() aura.Constant:Play() end tool.Equipped:connect(Equip)
I know I need to use RemoteEvents but I'm still kind of confused about that. How can the regular script In ServerScriptStorage define Local Player and the other variables in the Local Script to be able to run my Equip() function? Do I have to change some of the coding in my functions or can I just call them from the regular script in ScriptServerStorage?
Okay I'm pretty new to FE and all too but I think I got it so:
With the Local Script you basically send the server a 'warning' to make your things happen and the Script is where you put everything into practice.So what you'd have to do is:
Local Script
tool = script.Parent local RemoteEvent = game:GetService("ReplicatedStorage"):WaitForChild("Aura") --I put the RemoteEvents in the ReplicatedStorage, name it whatever you want but make sure to change :WaitForChild("YourNameHere") function Equip() RemoteEvent:FireServer(nil)--The Parameter is nil because I'm only passing the player(It automatically passes the player) end tool.Equipped:Connect(Equip)
Script
local RemoteEvent = game:GetService("ReplicatedStorage"):WaitForChild("Aura") RemoteEvent.OnServerEvent:Connect(function(player) --When it's Called aura.Anchored = false local weld = Instance.new("Weld") aura.CFrame = player.Character.Torso.CFrame weld.Parent = aura weld.Name = "BackWeld" weld.Part0 = char.Torso weld.Part1 = aura end)
Hope this helped you.