script {function touch(hit) hit.humanoid.Health = godsfinalresonance.Health - 20 end script.Parent.Touched:connect(touch) godsfinalresonance = game.workspace.Players.godsfinalresonance}
I tried putting my tag (godsfinalresonance = game.workspace.Players.godsfinalresonance) at the top but it told me line 1 had an error so I placed it at the bottom but now line 2 has an error. I'm trying to make it so when I step on the brick my health is reduced. I'm still a beginner so I would appreciate some assistance if possible.

2 comments
I changed my script to try to make it function here's the script {local godsfinalresonance = game.workspace.Players.godsfinalresonance if hit.parent:FindFirstChild("Humanoid") then function touch(hit) hit.Humanoid.Health = godsfinalresonance.Health - 20 end script.Parent.Touched:connect(touch)} the error is Workspace.Part.Script:7: 'end' expected (to close 'if' at line 2) near ''
You'd need it like this.. local godsfinalresonance = game.Players.godsfinalresonance script.Parent.Touched:connect(function(hit) if hit.Parent:FindFirstChild("Humanoid") then hit.Parent.Humanoid.Health = godsfinalresonance.Health - 20 end end)