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

How do i locate a player inside the workspace (i need to place something inside player's torso)?

So as i said in the title i need to place a new Instance inside of player's torso.This is how i've tried to do it but i can't locate the player inside the workspace

local ff = Instance.new("ForceField")
ff.Parent = game.Workspace.
ff.Visible = false

4 comments

0

What player you need to find?

0

An owner of it's parent script

0

You want this to happen like a regular force field each time the player respawns?

0

There is a certain fruit which when eaten should give that force field to a player

1 answer

Firstly, the following code should be a local script inside of StarterCharacterScripts

local player = game.Players.LocalPlayer
local character = player.Character
local ff = Instance.new("ForceField")
ff.Parent = character.Torso -- change Torso to UpperTorso or LowerTorso if you're using r15
ff.Visible = false

Each time the character spawns/respawns this code will run as the script reloads with the character.

6 comments

0

The problem is i am trying to execute this script after it's parent has transfered it to a player,which means i cannot put it inside StarterCharacterScripts

0

So you're trying to put the script in the player? That makes no sense it would be better to do it my way..

0

but i need to do it after a certain function of it's parent script is done

0

You didn't give enough info in your question

0

There is a certain fruit which when eaten should give that force field to a player

0

sounds like something he took from Roblox's catalog :P

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