So I am needing like if i have block named “Noob” and have 4 other “Noob” named blocks. How I can make every block fire the same script not only the original noob, but all the others too.
local clicker = game.Workspace.Noob.Seller -- I have 4 other blocks named by Noob so Ye
local mps = game:GetService("MarketplaceService")
local gamepass_id = 13538006
clicker.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
local player = game.Players.LocalPlayer
mps:PromptGamePassPurchase(player, gamepass_id)
end
end)
mps.PromptGamePassPurchaseFinished:Connect(function(player, id, purchased)
if id == gamepass_id and purchased then
game.ReplicatedStorage.Give6:FireServer()
end
end)
there is a mistake in your script u cannot use local player in script
try this:
clicker.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
local player = game.Players:FindFirstChild(hit.Parent.Name)
mps:PromptGamePassPurchase(player, gamepass_id)
end
end)
mps.PromptGamePassPurchaseFinished:Connect(function(player, id, purchased)
if id == gamepass_id and purchased then
game.ReplicatedStorage.Give6:FireServer()
end
end)
no, the findfirstchild is actually finding the player name whereas findFirstChildOfClass will only find stuff with a ClassName like script, Humanoid etc
LocalScripts can use the Touched signal, it doesn’t produce errors. So long as you’re conscious of where you’re placing your LocalScript (that being, in a container that can run client-side code), Touched is perfectly fine to use on the client.