
KeylessUniversal

-- LocalScript in StarterPlayerScripts
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
-- Function to add ForceField
local function addForceField()
if not character:FindFirstChildOfClass("ForceField") then
local ff = Instance.new("ForceField")
ff.Parent = character
end
end
-- Function to remove ForceField
local function removeForceField()
local ff = character:FindFirstChildOfClass("ForceField")
if ff then
ff:Destroy()
end
end
-- Create mobile button
local screenGui = Instance.new("ScreenGui")
screenGui.Parent = player:WaitForChild("PlayerGui")
local button = Instance.new("TextButton")
button.Size = UDim2.new(0, 150, 0, 50)
button.Position = UDim2.new(0.5, -75, 0.9, -25)
button.Text = "Force Field"
button.BackgroundColor3 = Color3.fromRGB(0, 170, 255)
button.TextScaled = true
button.Parent = screenGui
local active = false
-- Toggle ForceField when button is pressed
button.MouseButton1Click:Connect(function()
active = not active
if active then
addForceField()
button.Text = "Deactivate Force Field"
button.BackgroundColor3 = Color3.fromRGB(255, 0, 0)
else
removeForceField()
button.Text = "Force Field"
button.BackgroundColor3 = Color3.fromRGB(0, 170, 255)
end
end)No comments yet for this script.



