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

how could make a Robloxian get a ForceField when they click on a Gui?

So I was wondering how I could make a Robloxian get a Force Field when they click on a Gui?

I am using this script that I want to put in my Gui but when I enter it it wont work:

local debounce = false 
function onTouched(part)
	local h = part.Parent:findFirstChild("Humanoid")
	if h~=nil and debounce == false then
		debounce = true
		Field = Instance.new("ForceField")
		Field.Parent = part.Parent
		wait(0)
		debounce = false
	end
end

if (script.Parent ~= nil) and (script.Parent.className == "Part") then 
	connection = script.Parent.Touched:connect(onTouched)
end



This is the script inside the Gui just in case:

function Click()
script.Parent.Parent.Parent.Parent.Character.Torso.CFrame = CFrame.new(-8, 107.6, -17)----- Put the coordinates of the brick you want to teleport to. 
script.Parent.Visible = false
script.Parent.Parent.ToArena.Visible = true

end

script.Parent.MouseButton1Down:connect(Click)


The only thing that I need help with is making the Gui give FF on click everything else in the Gui works fine! Please help if you can! ^_^

1 answer

From script #1 it's obvious you know how to create a force field. From script #2 it's obvious you know how to get the character from a GUI. I don't see what the problem is.

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