My problem
I want to make a part, if i touch it, it should give me a tool(i putted it in ReplicatedFirst). I tried to make it in FilteringEnabled, but nope. I also tried it in FilteringDisabled but not work too. Here's the code. FilteringEnabled
local Players = game:GetService("Players")
local sword = game.ReplicatedFirst.ClassicSword
local backpack = Players.LocalPlayer.Backpack
local part = script.Parent
local function onTouched(part)
local player = Players:GetPlayerFromCharacter(part.Parent)
if not player then return end
sword:Clone()
sword.Parent = backpack
end
part.Touched:Connect(onTouched)
****FilteringDisabled
local Players = game.Players
local sword = game.ReplicatedFirst.ClassicSword
local backpack = Players.LocalPlayer.Backpack
local part = script.Parent
local function onTouched(part)
local player = Players:GetPlayerFromCharacter(part.Parent)
if not player then return end
sword:Clone()
sword.Parent = backpack
end
part.Touched:Connect(onTouched)
Hope you guys help me. Im new in scripting in Roblox. :)

1 comment
Thanks