so someone helped me with this last night and it worked but now it just wont work anymore. the script is not disabled and i dont know what the problem is
1 | script.Parent.Touched:Connect( function (hit) |
2 | local Player = game:GetService( 'Players' ):GetPlayerFromCharacter(hit.Parent) |
3 | if Player then |
4 | Player:WaitForChild( 'PlayerGui' ):WaitForChild( 'Tips' ).Enabled = true |
5 | print (Player.name.. " Hit The Brick" ) |
6 | end |
7 | end ) |
The script looks good from a quick scan over it, so I have an assumption as to why it may not work. Sometimes, you can get something that's not one of the main body parts to hit something, and the character from that part is not just hit.Parent. So try out this script.
01 | script.Parent.Touched:Connect( function (hit) |
02 | local hum = hit.Parent:FindFirstChild( "Humanoid" ) or hit.Parent.Parent:FindFirstChild( "Humanoid" ) --One of them will be valid, otherwise it is not a player |
03 | if hum ~ = nil then |
04 | local Player = game:GetService( 'Players' ):GetPlayerFromCharacter(hum.Parent) |
05 | if Player then |
06 | Player:WaitForChild( 'PlayerGui' ):WaitForChild( 'Tips' ).Enabled = true |
07 | print (Player.name.. " Hit The Brick" ) |
08 | end |
09 | end |
10 | end ) |
Hope this helps