I wan't to know this because I'm trying to add a system where if you touch a specific brick you earn or lose cash, this is my current code,
1 | local part = script.Parent |
2 | local player = game.Players.LocalPlayer |
3 |
4 | local function onTouch(hit) |
5 |
6 | end |
7 |
8 | script.Parent.Touched:Connect(onTouch) |
You would use the GetPlayerFromCharacter() function from "Players".
1 | local function onTouch(hit) |
2 | if hit.Parent:FindFirstChild( "Humanoid" ) then |
3 | local player = game.Players:GetPlayerFromCharacter(hit.Parent) |
4 | end |
5 | end |
6 |
7 | script.Parent.Touched:Connect(onTouch) |