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

Why Is my forcefield GUI not placing forcefield on the player?

Ello fellow robloxains! I have appear to come Into a problem when making a GUI as the name suggest Its a simple GUI button that makes a forcefield when you press It however It doesn't spawn on the player rather Instead In the middle of the baseplate how can I overcome this problem?

Script:

local plr = game.Players.LocalPlayer
script.Parent.MouseButton1Down:Connect(function()
	local Forcefield = Instance.new("ForceField")
	Forcefield.Parent = game.Workspace
	Forcefield.Position = plr.Character.HumanoidRootPart.Position
end)

2 answers

what i did to create the forcefield i just used instance.new in a clicked button fuction which i moved the mousebutton1click to the bottom

local player = game.Players.LocalPlayer
local character = player.Character
function ClickedButton()
	Instance.new("ForceField", character)
end
script.Parent.MouseButton1Click:connect(ClickedButton)

Chears!

You can't create a forcefield on the client (assuming this is a client script) since it will only show on the client with FilteringEnabled. Try using a Remote Event so it will run on the server.

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