Categories > Exploiting > Scripts >

[HELP] How do i detect when a part moves over a certain Position

Posts: 1

Threads: 1

Joined: Aug, 2023

Reputation: 0

Posted

In a small game im making script for (link below), theres a gamble machine where you drop a ball from a moving part to get it into a section to get double the points spent.

I've made a way for it to teleport the ball into the win section, for some reason the teleport only works when you drop the ball onto certain pegs. I'm not sure why and its really confusing.

 

game: https://www.roblox.com/games/13003664143/PROJECT-SUBMUS-ACCUDO-REBOOTED

 

local Library = loadstring(game:HttpGet("https://raw.githubusercontent.com/xHeptc/Kavo-UI-Library/main/source.lua"))()
local Window = Library.CreateLib("Project Sumbus Thing", "DarkTheme")

-- Gamble Machine --
local Tab = Window:NewTab("Gamble Machine")
local Section = Tab:NewSection("Do Gamble")

Section:NewButton("ButtonText", "ButtonInfo", function()
    local clickdetector = game.Workspace.Lobby.Interactables.Jechinko.Panel["5"].ClickDetector --amount of points where number is. 5, 10, 50, 100, 500, 1000

    fireclickdetector(clickdetector)
    wait(0.5)
    local Ball = game.Workspace.Lobby.Interactables.Jechinko.[ROBLOX USERNAME HERE].Part
    Ball.Position = Vector3.new(66.4798, 125.519, -1816.39)
end)
  • 0

Posts: 71

Threads: 6

Joined: Aug, 2022

Reputation: 6

Replied

Create a part at the desired location, do .Touched and just check if its the ball smh

  • 0

WetWipes

Professional Idiot

vip

Posts: 146

Threads: 32

Joined: Sep, 2020

Reputation: 14

Replied

You could loop this If part.CFrame = CFrame.new(whatever the coordinates needs to be)

 

or if you need it to activate when its NEAR another part you could do this 

local PartOne = game.Workspace.PartOne
local PartTwo = game.Workspace.PartTwo

local function GetDistance(d1,d2)
    local Distance = (d1.Position - d2.Position).magnitude
    return Distance
end


while wait() do
    if GetDistance(PartOne, PartTwo) < 15 then --If PartOne is within 15 studs of PartTwo it activates
    --code
    end
end
  • 0

Open to help anyone with anything, DM me on discord :)

Users viewing this thread:

( Members: 0, Guests: 1, Total: 1 )