Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 10 years ago

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

Log in to vote
0
Answered by
Perci1 4988 Trusted Moderation Voter Community Moderator
10 years ago

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.

Ad

Answer this question