Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Easy script is not working in roblox player, can you help me or tell me other way to do it?

script.Parent.Touched:Connect(function(hit)
	if hit.Parent:FindFirstChild("Humanoid") then
           -- any script you put here will work in studio but not in player
        end
end)

1 answer

Hello SuperBeeperman, you can use this.

script.Parent.Touched:Connect(function(hit)
       local Player = game.Players:GetPlayerFromCharacter(hit.Parent) -- Returns the Player associated with the given character, or nil if the character is not controlled by a player.
       if Player then
             print(Player.Name)
             --  ur script here
       end
end)

This discussion is preserved as it was. New answers, comments, and votes are closed.