#Trying to make a kamui dimension tp

1 messages · Page 1 of 1 (latest)

terse pebble
#

when you put ur mouse on the player it highlights them and click to tp them. When they are inside their movements are 10x and when they are clicked again they get sent to the new position like the minecraft nether

#

local tool = script.Parent
local plr = game:GetService("Players").LocalPlayer
local UIS = game:GetService("UserInputService")
local RunService = game:GetService("RunService")
local camera = workspace.CurrentCamera

local event = tool:WaitForChild("TargetDimensionEvent")

local equipped = false
local hoverHighlight = nil
local currentTarget = nil

-- Highlight detection loop
RunService.RenderStepped:Connect(function()
if not equipped then
if hoverHighlight then
hoverHighlight:Destroy()
hoverHighlight = nil
end
currentTarget = nil
return
end

local mousePos = UIS:GetMouseLocation()
local closest = nil
local closestDist = 50
#

for _, p in pairs(game.Players:GetPlayers()) do
if p ~= plr and p.Character and p.Character:FindFirstChild("HumanoidRootPart") then
local pos, onScreen = camera:WorldToViewportPoint(p.Character.HumanoidRootPart.Position)
if onScreen then
local dist = (Vector2.new(pos.X, pos.Y) - Vector2.new(mousePos.X, mousePos.Y)).Magnitude
if dist < closestDist then
closest = p
closestDist = dist
end
end
end
end

if closest then
    currentTarget = closest
    if not hoverHighlight then
        hoverHighlight = Instance.new("Highlight")
        hoverHighlight.FillColor = Color3.fromRGB(255, 255, 0)
        hoverHighlight.FillTransparency = 0.5
        hoverHighlight.OutlineColor = Color3.fromRGB(255, 255, 255)
        hoverHighlight.Adornee = closest.Character
        hoverHighlight.Parent = closest.Character
    else
        hoverHighlight.Adornee = closest.Character
    end
else
    currentTarget = nil
    if hoverHighlight then
        hoverHighlight:Destroy()
        hoverHighlight = nil
    end
end

end)

tool.Equipped:Connect(function()
equipped = true
end)

tool.Unequipped:Connect(function()
equipped = false
if hoverHighlight then
hoverHighlight:Destroy()
hoverHighlight = nil
end
currentTarget = nil
end)

UIS.InputBegan:Connect(function(input, gp)
if gp or not equipped then return end
if input.UserInputType == Enum.UserInputType.MouseButton1 then
if currentTarget then
event:FireServer(currentTarget)
end
end
end)

#

thats the script

#

this is whne the player with the tool clicks on someone else

#

its supposed to send them to the dimension

#

and in the dimension ur movements are 10x the real world

#

so when ur clicked on again (in dimension) you leave the world 10x your movements in the dimension

#

please help