Hey guys! I have a script that makes a player drop their candy in this Halloween game I am making. Problem is, it doesnt work on Filtering Enabled servers. Im very new to Filtering Enabled, so if someone could tell me what to do, that'd be great! Thank you!
Here is my script
wait(.5)
--Very inefficient but whatever aaa
script.Parent = script.Parent.Humanoid
local playeer = script.Parent.Parent.Name
local player = game.Players[playeer]
--------------------------------------------------------------------------------
--Put in startercharacter
script.Parent.Died:connect(function()
local i = math.random(1,10)
if (player.leaderstats.Candy.Value - i) < 0 then
i = player.leaderstats.Candy.Value
end
player.leaderstats.Candy.Value = player.leaderstats.Candy.Value - i
--------------------------------------------------------------------------
if i ~= 0 then
repeat
i = i - 1
local position = script.Parent.Parent.Torso.CFrame*CFrame.new(math.random(-4,4),8,math.random(-4,4))
local Candy = game.ServerStorage.Candy:Clone()
Candy:Clone()
Candy.Parent = game.Workspace
Candy.CFrame = position
until i <= 0
----------------------------------------------------
for i,v in pairs (script.Parent.Parent:GetChildren()) do
if v:IsA("BasePart") or v:IsA("Accessory") then
v:Destroy()
end
end
end
end)

1 comment
Think about it. Client changes do not get replicated to the server. RemoteEvents are for transferring data to client and server and server to client.