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

When I try to use GUI tweening, nothing shows up. Did I do something wrong?

Asked by 4 years ago
Edited 4 years ago

Heres an interesting one. I'm trying to make a script that will make it say "Happy Birthday" on the screen. I tried to make it tween to the middle of the screen, but when I run it literally nothing pops up.

Server Script:

--[[
    This is a happy birthday script for a friend. Its free of viruses.
    Scripted by FrostedFlakes67 c:
--]]

print("Birthday script by FrostedFlakes67 loaded.")

--A little credit--
local Credit = script.Parent.Credit
game.Players.PlayerAdded:Connect(function(plr)
    local Clone = Credit:Clone()
    Clone.Parent = plr.PlayerGui
end)

--GUI--
local HostName = "FrostedFlakes67"
game.Players.PlayerAdded:Connect(function(plr)
    if plr.Name == HostName then
        print("Host Joined!")
        plr.Chatted:Connect(function(msg)
            print("Host chatted: "..msg)
            local msglower = string.lower(msg)
            print("Lowercase versision: "..msglower)
            if msglower == "happy birthday, alexis!" then
                warn("Starting!")
                script.Parent.Start:FireAllClients()
            end
        end)
    end
end)



--Local Script--
script.Parent.Tweening.Parent = game.StarterPlayer.StarterPlayerScripts

Local script:

--[[
Some tweening c:
Scripted by FrostedFlakes67
]]

game.Workspace["Happy birthday!"].Start.OnClientEvent:Connect(function()
    print(game.Players.LocalPlayer.Name.." recieved the message!")
    local Text = game.Workspace["Happy birthday!"]["Happy Birthday"].TextLabel
    print("Text found, starting tweening.")
    Text:TweenPosition(
        UDim2.new(0.5,0,0.5,0),
        Enum.EasingDirection.In,
        Enum.EasingStyle.Quart,
        1
    )
    print("Tweening finished! Script ending.")
end)

Please tell me if I did something wrong. (This time, I'm getting output from everything in both scripts. It says it finished, even though nothing happened.)

0
Try replacing "In" and "Quart" with Enum.EasingDirection.In and Enum.EasingStyle.Quart milkydadup 1 — 4y
0
for the anchor points they both need to be set to .5 for it to work :) UltraUnitMode 419 — 4y
0
Nevermind.. sorry about that.. Anyways, Also it could be possible that whenever you chat "Happy birthday, Alexis!" one word is lower cased which then it wont register. try using string.lower() UltraUnitMode 419 — 4y
0
I copy and paste it from that, but i'll add string.lower() FrostedFlakes67 71 — 4y
View all comments (10 more)
0
I tried both of those suggestions, and it still isnt working FrostedFlakes67 71 — 4y
0
Oh, wait. I just solved it myself. This is a server script, so I need to clone it to everyone. FrostedFlakes67 71 — 4y
0
I edited it. FrostedFlakes67 71 — 4y
0
Still doesn't work. I'll check back in the morning for answers. (I don't get the output for when it starts, so something is wrong with that part.) FrostedFlakes67 71 — 4y
0
You can store the LocalScript as a child of StarterPlayerScripts under StarterPlayer. There is no need to move it when they join. This program also has no TweenPosition methods or UDim2 modifications visible, which shows that this code is not responsible for the issue, please give us the program that Tweens the GUI you mentioned Ziffixture 6913 — 4y
0
Oh, sorry. Let me add the local script. FrostedFlakes67 71 — 4y
0
The problem with making it a part of StarterPlayerScripts is I'm making it a folder so for a model, so I cant just have one part in another category, it all needs to stay in the folder. FrostedFlakes67 71 — 4y
0
Ok, I made some changes, let me update this. FrostedFlakes67 71 — 4y
0
Ok, I made some changes, let me update this. FrostedFlakes67 71 — 4y
0
lemme write you an answer User#23252 26 — 4y

1 answer

Log in to vote
2
Answered by 4 years ago

well there's a problem, although when designing GUIs in Roblox studio they appear under StarterGui, when you run the game, the GUIs are actually cloned to the PlayerGui of each player that joins. all visible GUI's that are in the PlayerGui of a player will be visible on their screen. however, the text label that you want to tween is in workspace, as indicated that this line of code: local Text = game.Workspace["Happy birthday!"]["Happy Birthday"].TextLabel.. also make sure things that are accessed by both Server Scripts, and LocalScripts are place in the ReplicatedStorage.. with that said, here's how i'd write the code.

Server side:

local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage");
local tweenInitializer = ReplicatedStorage.Start -- the remote event

local host = "FrostedFlakes67" --host's name


Players.PlayerAdded:Connect(function(player)
    if(player.Name == host) then
        print("The Host joined..");
        player.Chatted:Connect(OnHostChatted)
    end
end)

function OnHostChatted(msg)
    print("The Host has chatted");
    if(msg:lower() == "happy birthday, alexis!" then
        tweenInitializer:FireAllClients();
    end
end

LocalScript also make sure the GUI that tweens is in the StarterGui b/c remember, all guis in the StarterGui are cloned in the player's PlayerGUI once they join.. once you make sure its the StarterGui then put a LocalScript in the GUI that tweens and write the following in it..

local ReplicatedStorage = game:GetService("ReplicatedStorage");
local tweenInitializer = ReplicatedStorage.Start -- the remote event

tweenInitializer.OnClientEvent:Connect(function()
    local endPosition = udim2.new(.5,0,.5,0)
    script.Parent:TweenPosition(
    endPosition,           -- Final position the tween should reach
    Enum.EasingDirection.Out, -- Direction of the easing
    Enum.EasingStyle.Quad,   -- Kind of easing to apply
    2,                       -- Duration of the tween in seconds
    true                    -- Whether in-progress tweens are interrupted
    )
end)

this show work... test it and see is there's any errors.. also make sure the GUI that tweens is visible

0
Ok, testing it now. FrostedFlakes67 71 — 4y
0
It worked! Thanks. FrostedFlakes67 71 — 4y
Ad

Answer this question