脚本只在 Studio 中工作

//编辑:是的,我添加了第二个参数 GPE,如果没有 GPE,则返回结尾以防止某人苛刻不必要的细节

另一个问题是它相当长,但如果您阅读它并发现有什么问题,请让我知道。我将其作为 Startpack 中的 LocalScript。

local uis = game:GetService("UserInputService")
local torso = script.Parent.Parent.Character.Torso or script.Parent.Parent.Character.UpperTorso
local TweenService = game:GetService("TweenService")
local db = true

function move(x)
local velocity = Instance.new("BodyVelocity")
velocity.Velocity = torso.CFrame.lookVector*50
velocity.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
velocity.Parent = x
end

uis.InputBegan:Connect(function(input)
if input.KeyCode == Enum.KeyCode.R and db then
db = false

local part = game:GetService("ReplicatedStorage").Union:Clone()
part.CFrame = torso.CFrame + torso.CFrame.lookVector*10
part.Parent = game.Workspace

local effect = game.ReplicatedStorage.Waterfall:Clone()
effect.CFrame = part.CFrame

local light = game:GetService("ReplicatedStorage").PointLight:Clone()
light.Parent = part

local weld = Instance.new("ManualWeld")
weld.Part0 = part
weld.Part1 = effect
weld.Parent = part
effect.Parent = part

local goal3 = {}
goal3.Size = Vector3.new(120,70,70)

local goal4 = {}
goal4.Size = goal3.Size

local tweenInfo = TweenInfo.new(2)

local tween3 = TweenService:Create(part, tweenInfo, goal3)
local tween4 = TweenService:Create(effect,tweenInfo, goal4)

tween3:Play(); tween4:Play()

game.Lighting.Blur.Enabled = true; game.Lighting.ColorCorrection.Enabled = true

move(part)
part.Anchored = false
effect.Anchored = false
move(effect)

local goal = {}
goal.Size = Vector3.new(30,7,7)
goal.Transparency = 0.4

local goal2 = {}
goal2.Size = goal.Size

local tweenInfo = TweenInfo.new(3)

local tween = TweenService:Create(part, tweenInfo, goal)
local tween2 = TweenService:Create(effect,tweenInfo, goal2)

tween:Play(); tween2:Play()

game:GetService("Debris"):AddItem(part,2)
game:GetService("Debris"):AddItem(effect,2)
wait(.5)
game.Lighting.Blur.Enabled = false; game.Lighting.ColorCorrection.Enabled = false
db = true

end
end)

这个东西很简单,它在我发布游戏并播放时不起作用,但它只能在 Roblox Studio 中使用。 它还没有开启筛选启用,仍然无法正常工作。我不知道确切的情况。

点赞
用户9648982
用户9648982
Fixed it lol i just moved the localscript from starterpack to startercharacter :D

翻译:

修好了,哈哈,我只是把本地脚本从 StarterPack 移动到了 StarterCharacter 中。 :D

2018-04-22 13:41:43