I have a script that enables a particle emitter on the player's torso when it touches this block. It's for an invincibility-effect type thing. But I come across an error while trying to make it work.
13:00:33.055 - GetPlayerFromCharacter is not a valid member of DataModel 13:00:33.056 - Script 'Workspace.DashPanel.DashPart.ParticleScript', Line 3
Here's the script:
function onTouched(hit)
if workspace:findFirstChild(hit.Parent.Name) then
local players = game:GetPlayerFromCharacter(hit.Parent)
workspace.player.Torso.DashParticle.Enabled = true
wait(1)
workspace.player.Torso.DashParticle.Transparency = NumberSequence.new(.4)
wait(1)
workspace.player.Torso.DashParticle.Enabled = false
workspace.player.Torso.DashParticle.Transparency = NumberSequence.new(0)
end
end
script.Parent.Touched:connect(onTouched)
I figure the way to fix this is to get the script to insert the name of the player to replace the placeholder in lines like workspace.**player.**Torso.DashParticle.Enabled, but there's probably other solutions to stop getting this error that I'm open to. Thanks in advance!

2 comments
i am relatively new to scripting, and this response really helped! Thanks!
No problemo~!