Help creating a zero gravity script that activates when you touch an invisible part

This is the system I want to make

using this model

idk how to do it (the script is activated when you start playing but I don’t want that to happen)

the red invisible part should deactivate and the green should activate

2 Likes

You can set the Script to disabled and then make it enabled when you need it to

1 Like

how would I do that (sry for asking I just don’t have much coding knowledge)

1 Like
local script = SCRIPT_LOCATION
--[ Enables the Script ]--
script.Disabled = false 

local script = SCRIPT_LOCATION
--[ Disables the Script ]--
script.Disabled = true 

1 Like

how would I set it so if the player touches a part named 0-grav-activator it will enable it (part will have no colision and be invisible)

where is the part located workspace?

it is in workspace but when starting the game it puts the scripts under starter character and 1 in starter player (also one script is still in the workspace under a group named OPEN ME) but idk if I need that one

whats the scripts name in startercharacter and starterplayer

starter character is Fly

starter player is 360Cam

2nd starter player is Roll

Not sure if this would work but you can try it

local activ = game:GetService('Workspace'):WaitForChild('0-grav-activator')

activ.Touched:Connect(function(hit)
   if hit.Parent:FindFirstChild(“Humanoid”) then
      local plrname = hit.Parent.Name
      local plr = game:GetService("Players")[plrname]
      local character = hit.Parent
      local script1 = character:WaitForChild("Fly")
      local script1.Disabled = false
   end
end)

so I put that in all of the starter player and character scripts?

so where do I put this script again?

-- PUT THIS IN STARTERPLAYERSCRIPTS
local part = workspace:WaitForChild("Part") -- your part's name

part.Touched:Connect(function(hit)
	if (hit.Parent:FindFirstChildWhichIsA("Humanoid")) and (hit.Parent:FindFirstChild("Humanoid") == game.Players.LocalPlayer.Character:FindFirstChild("Humanoid")) then
			workspace.Gravity = 0 -- Gravity you want for it to be then player touches a part
	end
end)

that works but it was not what I was looking for.

I need a script that activates the scripts in this model
https://www.roblox.com/library/8423413138/Fly-Script-360-Camera
when touching a part with the name 0-grav-activator
(can you look at the model and figure out how to activate the script from there?)
thanks

this thing will not work on mobile, so your game will be for computer players?

yes because I can’t find one that does what I want for mobile (trying to make a sci-fi jailbreak type game in space)

I think you can make a mobile button and u fire the server to make mobile use it

ok also about 55% of people are mobile/tablet players

I could always try to make it mobile compatible later

also how to get it to only activate and de activate when I touch a part

(activating when the player touches a part named (0-grav-activator)
(deactivating when the player touches a part named (0-grav-deactivator)

so did you find a way to make it work?