I am attempting to have a ball drop, cloned from ReplicatedStorage named “Ball”, hit a part that is meant to detect it by it’s name “Ball” and act accordingly. But it does not seem to be detecting parts from ReplicatedStorage even if it is named properly, why is this? It works if I place the Ball in workspace without cloning it. Here is the script
local multiplyer = script.Parent
local remote = script.Parent.RemoteEvent
multiplyer.Touched:Connect(function(Hit)
if Hit:IsA("Part") and Hit.Name == "Ball" then
multiplyer.Material = Enum.Material.Neon
print("Ball hit!")
end
end)
.Touched will only detect touches from objects in the same place as multiplayer
if multiplayer is in workspace, it will only detect touches from objects in workspace
Well that is very odd because the script is cloning items from ReplicatedStorage into the Workspace, so it should be from the same place as the object being touched, but I will do an extra review on that.
Hello, I am not sure If this Is an Issue but after cloning the object, make sure to parent it to the workspace. This allows the part to interact with other objects and be detected
local multiplyer = script.Parent
local ReplicatedStorage = game:GetService("ReplicatedStorage")
-- Clone the ball and parent it to Workspace
local ballClone = ReplicatedStorage:WaitForChild("Ball"):Clone()
ballClone.Parent = workspace -- Parent the cloned ball to Workspace
ballClone.Position = Vector3.new(0, 50, 0) -- Set the position of the ball
multiplyer.Touched:Connect(function(Hit)
if Hit:IsA("Part") and Hit.Name == "Ball" then
multiplyer.Material = Enum.Material.Neon
print("Ball hit!")
end
end)