Ayuda en Scirpt

Hello everyone, right now I am learning a bit of scripting and I need if it is possible for someone to solve my doubts, the next one is because it does not work as it should or as I want the following script to work.

local Boton = script.Parent.Parent
local Plataforma = game.Workspace.Plataforma
local Espera = true

script.Parent.MouseClick:Connect(function()
	
if Espera == true then
	
	local TweenService = game:GetService("TweenService")
	
	local tweeninfo = TweenInfo.new(3, Enum.EasingStyle.Linear, Enum.EasingDirection.In, 0, false, 0.5)
	
	local nuevoCFrame = CFrame.new(-5, 21.75, -60.75) * CFrame.Angles(0, math.rad(180), 0)

    local newTween = TweenService:Create(Plataforma, tweeninfo, {CFrame = nuevoCFrame }):Play()
	
    Espera = false
    
elseif Espera == false then
	
	wait(1)
		
	local TweenService = game:GetService("TweenService")
	
	local tweeninfo = TweenInfo.new(3, Enum.EasingStyle.Linear, Enum.EasingDirection.In, 0, false, 0.5)
	
   	local nuevoCFrame = CFrame.new(-5, -15.75, -60.75) * CFrame.Angles(0, math.rad(360), 0)

    local newTween = TweenService:Create(Plataforma, tweeninfo, {CFrame = nuevoCFrame }):Play()

	Espera = true
end
end)

Can you say what doesn’t work? And, there isn’t reccommended to do posts and only say it doesn’t works.

the problem is that first I want everything I want it to go up vertically and the part goes horizontally, the second thing is that I want first to go up and then turn and read but this doesn’t do the opposite of what you assign

Cuando usas tu script, que lo hace? Yo creo que tu problema es que estas usando “if y elseif”

Prueba esto:

local Boton = script.Parent.Parent
local Plataforma = game.Workspace.Plataforma
local Espera = true

script.Parent.MouseClick:Connect(function()
	local TweenService = game:GetService("TweenService")
	
	local tweeninfo = TweenInfo.new(3, Enum.EasingStyle.Linear, Enum.EasingDirection.In, 0, false, 0.5)
	
	local nuevoCFrame = CFrame.new(-5, 21.75, -60.75) * CFrame.Angles(0, math.rad(180), 0)

    local newTween = TweenService:Create(Plataforma, tweeninfo, {CFrame = nuevoCFrame }):Play()
	
	wait(1)
		
	local TweenService = game:GetService("TweenService")
	
	local tweeninfo = TweenInfo.new(3, Enum.EasingStyle.Linear, Enum.EasingDirection.In, 0, false, 0.5)
	
   	local nuevoCFrame = CFrame.new(-5, -15.75, -60.75) * CFrame.Angles(0, math.rad(360), 0)

    local newTween = TweenService:Create(Plataforma, tweeninfo, {CFrame = nuevoCFrame }):Play()
end)

Ahora, Si esto no funciona, piensas que puedes envĂ­anos un GIF?

Emm quiero decir que uso if y elseif para llevar el control de clicks, para asĂ­ dar un click para subir y otro click para bajar XD

Ohhhh, Yo era confundido xd.

Prueba esto:

local TweenServicio = game:GetService("TweenService")
local Boton = script.Parent.Parent
local Plataforma = game.Workspace.Plataforma
local Espera = true

local function TweenObjeto(Objeto, Informacion, Objetivo)
	if Objeto and Informacion and Objetivo then
		return TweenServicio:Create(Objeto, Informacion, Objetivo)
	end
end

script.pairs.MouseClick:Connect(function()
	if Espera then
		Espera = false

		TweenObjeto(Plataforma, TweenInfo.new(3), {CFrame = CFrame.new(-5, 21.75, -60.75) * CFrame.Angles(0, math.rad(180), 0)}):Play()

	elseif not Espera then
		Espera = true

		TweenObjeto(Plataforma, TweenInfo.new(3), {CFrame = CFrame.new(-5, -15.75, -60.75) * CFrame.Angles(0, math.rad(360), 0)}):Play()

	end
end)

No se si la CFrame esta mal, Pero yo se que estabas usando tweeninfo en una manera confusa.
Tambien: Lo siento si mi español no tiene sentido, Yo pense si hablo en español sería más fácil de entender.

1 Like

Tu español no es tan malo y pues lo unico que puedo decir es en lo primero que dijistes es el verbo to be para los gringos que eso puede signifacar ser o estar pero en español es mas especifico asi que mejor di Yo estaba confundido xd.

Con lo del script que me acabas de mandar por el momento se que que signica el pairs.

1 Like