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

How to reinforce part teleport position?

Asked by 6 years ago
Edited 6 years ago

I haz script for platform that always stays directly below u

-- i haz localscript!!!! :P
-- and i haz filtering enabled!! :P
local LocalPlayer = game:GetService("Players").LocalPlayer
local LoaderGui = game:GetService("Players").LocalPlayer:WaitForChild("PlayerGui"):WaitForChild("LoadingScreen")
local Frame = LoaderGui.Frame or LoaderGui:WaitForChild("Frame")
local Text = Frame.TextLabel or Frame:WaitForChild("TextLabel")
--LoaderGui.Enabled = true
game:GetService("Players").LocalPlayer:WaitForChild("PlayerGui"):SetTopbarTransparency(0)
LocalPlayer.Character.Humanoid.WalkSpeed = 0
LocalPlayer.Character.Humanoid.JumpPower = 0
wait()
local character = LocalPlayer.Character
local humroot = character.HumanoidRootPart
local platform = Instance.new("Part", game.Workspace)
-- set up properties of the platform
platform.Transparency = 0.7
platform.Material = "Glass"
platform.Size = Vector3.new(5, 1, 5)
platform.Anchored = true
platform.CustomPhysicalProperties = PhysicalProperties.new(5, 2, 0.5, 5, 0.5)
platform.Parent = game.Workspace
platform.Size = Vector3.new(5, 1, 5); platform.Material = "Glass"; platform.Anchored = true; platform.Transparency = 0.4
platform.Name = "Platform"
game:GetService("PhysicsService"):SetPartCollisionGroup(platform, "PlatformGroup")
--[[local positionCo = coroutine.create(function()
    while true do
        platform.Position = Vector3.new(humroot.Position.X, -0.501, humroot.Position.Z)
        game:GetService("RunService").RenderStepped:Wait()
    end
end)
coroutine.resume(positionCo)]]
local function movePlatform()
    platform.Position = Vector3.new(humroot.Position.X, -0.501, humroot.Position.Z) -- importent
end
game:GetService("RunService"):BindToRenderStep("Move platform", Enum.RenderPriority.Camera.Value - 1, movePlatform)
wait(0.1)
Text.Text = "Loading done!"
wait(1)
game.Workspace.Spawn.CanCollide = false
for i=0,1,0.025 do
    Frame.BackgroundTransparency = i
    Text.TextTransparency = i
    if i >= 0.5 then
        Text.TextStrokeTransparency = i
        Frame.BackgroundTransparency = i
        Text.TextTransparency = i
        game:GetService("Players").LocalPlayer:WaitForChild("PlayerGui"):SetTopbarTransparency(i)
    end
    wait(0.025)
end
character.Humanoid.WalkSpeed = game:GetService("StarterPlayer").StarterHumanoid.WalkSpeed -- 500
character.Humanoid.JumpPower = game:GetService("StarterPlayer").StarterHumanoid.JumpPower -- 50
LoaderGui.Enabled = false

and i haz hierarchy

StarterPlayer

StarterCharacterScripts

PlatformScriptroni

and i haz importent part

local function movePlatform()
    platform.Position = Vector3.new(humroot.Position.X, -0.501, humroot.Position.Z) -- importent
end
game:GetService("RunService"):BindToRenderStep("Move platform", Enum.RenderPriority.Camera.Value - 1, movePlatform)

wooo!!!!!!!!!!

Anyways...

If a player runs into another player, they trip.

And when they trip, the platform kerfluffles and ends up teleporting above the player because the player ends up in the way of the teleport destination, resulting in the player falling down to their deaths (not really, I have a script to prevent this.)

How do I make sure the platform always goes to Y -0.501 instead of receiving a kerfuffle?

(BTW, I used Studio to notice this)

(Also BTW, all typos & whatever at beginning (up to until "Anyways...") are intentional)

1
Set its CFrame instead of Position Amiaa16 3227 — 6y
0
I figured. Thank you! sweetkid01 176 — 6y

Answer this question