Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

why wont tween service move my block?

so i have 3 scripts that are the same thing and they work but the block wont move. can someone help?

    local plr = game:GetService("Players").LocalPlayer
local TweenService = game:GetService("TweenService")
local plat1 = game:GetService("Workspace").Moving.plat1
local tweeningInformation = TweenInfo.new(
    7,   
    Enum.EasingStyle.Linear,
    Enum.EasingDirection.InOut,
    0,
    false,
    0
)

local Move1 = {CFrame = CFrame.new(100.268, 182.064, -185.972)}
local ComeBack1 = {CFrame = CFrame.new(100.268, 182.064, -199.157)}
local tween1move = TweenService:Create(plat1,tweeningInformation,Move1)
local tween1comeback = TweenService:Create(plat1,tweeningInformation,ComeBack1)


game.ReplicatedStorage.Plat.OnServerEvent:Connect(function(player)
    print("Started")
    wait(11)
    if game.ReplicatedStorage.Platform.Value == 1 then
        tween1move:Play()
        wait(300)
        tween1comeback:Play()
    end
end)

SCRIPT THAT CHANGES VALUE

local qtable = {}
qtable[1] = "How do you say Apple in spanish"
qtable[2] = "In the rubiks cube wca, What shape is the megaminx"
qtable[3] = "What's Ikon's most liked song"
local storage = game.ReplicatedStorage
game.ReplicatedStorage.starting.OnClientEvent:Connect(function(player)
    local random = math.random(1, 3)
    print("Client Fired")
	storage.Plat:FireServer()
    wait(10)
    if random == 1 then 
        script.Parent.Text = "Platform 1, "..qtable[math.random(1,3)].."?"
        storage.Platform.Value = 1
    elseif random == 2 then
        script.Parent.Text = "Platform 2, "..qtable[math.random(1,3)].."?"
        storage.Platform.Value = 2
    elseif random == 3 then
        script.Parent.Text = "Platform 3, "..qtable[math.random(1,3)].."?"
        storage.Platform.Value = 3
    end
end)

SCRIPT that are like the first one but minor changes

    local plr = game:GetService("Players").LocalPlayer
local TweenService = game:GetService("TweenService")
local plat2 = game:GetService("Workspace").Moving.plat2
local tweeningInformation = TweenInfo.new(
    7,   
    Enum.EasingStyle.Linear,
    Enum.EasingDirection.InOut,
    0,
    false,
    0
)

local Move2 = {CFrame = CFrame.new(86.359, 182.064, -186.982)}
local ComeBack2 = {CFrame = CFrame.new(86.359, 182.064, -199.157)}
local tween2move = TweenService:Create(plat2,tweeningInformation,Move2)
local tween2comeback = TweenService:Create(plat2,tweeningInformation,ComeBack2)


game.ReplicatedStorage.Plat.OnServerEvent:Connect(function(player)
    print("Started")
    wait(11)
    if game.ReplicatedStorage.Platform.Value == 2 then
        tween2move:Play()
        wait(300)
        tween2comeback:Play()
    end
end)

    local plr = game:GetService("Players").LocalPlayer
local TweenService = game:GetService("TweenService")
local plat3 = game:GetService("Workspace").Moving.plat3
local tweeningInformation = TweenInfo.new(
    7,   
    Enum.EasingStyle.Linear,
    Enum.EasingDirection.InOut,
    0,
    false,
    0
)

local Move3 = {CFrame = CFrame.new(72.223, 182.064, -186.43)}
local ComeBack3 = {CFrame = CFrame.new(72.223, 182.064, -199.157)}
local tween3move = TweenService:Create(plat3,tweeningInformation,Move3)
local tween3comeback = TweenService:Create(plat3,tweeningInformation,ComeBack3)


game.ReplicatedStorage.Plat.OnServerEvent:Connect(function(player)
    print("Started")
    wait(11)
    if game.ReplicatedStorage.Platform.Value == 3 then
        tween3move:Play()
        wait(300)
        tween3comeback:Play()
    end
end)

7 comments

0

Are there any errors in console?

0

Is game.ReplicatedStorage.Platform.Value == 1?

0

the others scripts do the same because another script changes the value so the 3 scripts check its value because it could be 1 2 or 3

0

The script looks good. Are you seeing "Started" in the console?

0

yeah but it isnt moving

0

that means game.ReplicatedStorage.Platform.Value does not equal 1. Can you show us the script that sets the Platform value?

0

ima sho all scripts

1 answer

In "SCRIPT THAT CHANGES VALUE",

it fires the remote event before it changes the value.

move it to the bottom of the script like this:

local qtable = {}
qtable[1] = "How do you say Apple in spanish"
qtable[2] = "In the rubiks cube wca, What shape is the megaminx"
qtable[3] = "What's Ikon's most liked song"
local storage = game.ReplicatedStorage
game.ReplicatedStorage.starting.OnClientEvent:Connect(function(player)
    local random = math.random(1, 3)
    print("Client Fired")
    wait(10) --delete this if you want
    if random == 1 then 
        script.Parent.Text = "Platform 1, "..qtable[math.random(1,3)].."?"
        storage.Platform.Value = 1
    elseif random == 2 then
        script.Parent.Text = "Platform 2, "..qtable[math.random(1,3)].."?"
        storage.Platform.Value = 2
    elseif random == 3 then
        script.Parent.Text = "Platform 3, "..qtable[math.random(1,3)].."?"
        storage.Platform.Value = 3
    end
    storage.Plat:FireServer()
end)

EDIT! if you are not doing experimental mode, then move setting the storage.Platform.Value to server side. this won't work in normal games.

7 comments

0

still didnt work but thanks for trying

0

@AlertoMiAmigo2, look at my edits!

0

wdym server side?

0

you can't set values in the client, including in replicated storage. the server can set values in replicated storage. move randomizing the question to the server script.

0
0

so move the plat to server storage and somehow put the randomizing question into my server script?

0

want me to post my server script and you can edit for me? idk how to do

This discussion is preserved as it was. New answers, comments, and votes are closed.