What I want to achieve?
I want to give the player who touched a model a tool
local part = script.Parent.Handle
local repl = game:GetService("ReplicatedStorage")
local tool = repl.fruits.Tool.Gum_bum
part.Touched:Connect(function(Object)
if Object.Parent:FindFirstChild("Humanoid") then
local Player = game.Players[Object.Parent.Name]
tool:Clone()
tool.Parent = Player.Backpack
end
end)
So this piece of code used to work back in the day we didn’t necessarily needed to use remote events. But we do really need to use them now.
This will give the player the tool you want him to have but only locally. In order to give the tool to the player locally and server sided whe shall need to use remote events.
Local script:
local part = script.parent.Handle
local repl = game:GetService("ReplicatedStorage")
part.Touched:Connect(function(object)
if Object.Parent:FindFirstChild("Humanoid") then
repl.YourRemoteEvent:FireServer()
end
end)