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

[Solved] Appairing Gui when using a tool ?

Asked by 4 years ago
Edited 4 years ago

Hello everyone,

So i have a tool when i use it i get like let's say 10 Force if this happens i have a gui who appear with a +10 now the problem is everything is working fine i have in my tool 10 Gui`s with different locations where the gui appear

script.Parent.TextLabel:TweenPosition(UDim2.new(0.325, 0,0.605, 0),"Out","Quint",1,true)
wait(3)
script.Parent.Parent.Hit:Destroy()

This is working fine so far but it show`s me only 1 gui i would like that it show my a gui every time i click/use my tool (i have a cooldown of 0.7 seconds between each clicks)

Here is the code from tool i use to copy the gui`s

            script.Parent.Animation:GetChildren()[math.random(1, #script.Parent.Animation:GetChildren())]:clone().Parent = game.Players.LocalPlayer.PlayerGui
            game.Players.LocalPlayer.PlayerGui.Hit.TextLabel.Text = "    +10"

Would be happy if someone have an idee how i could resolve this or maybe make it bether :)

0
You could try putting the GUI in the tool and then make a clone that's parent is StarterGui. PrismaticFruits 842 — 4y
0
The Gui is already in the tool Tool/Animation/Hit is there a difference between cloning it to PlayerGui or StarterGui like my Script already do ? Ravage1337 35 — 4y
0
You could use a remote function. N43FGXL 169 — 4y

3 answers

Log in to vote
1
Answered by
haba_nero 386 Moderation Voter
4 years ago

Try using UDIM2 to put the gui and also try cloning it as shown here: Put the GUI with the textlabel in Lighting Put this script inside the tool:

local Tool = script.Parent
local GUI = game.Lighting:FindFirstChild("ScreenGui")--Your Gui with text label
local Text = GUI:FindFirstChild("TextLabel")
Text.Text = "+10"
Tool.Activated:Connect(function()
    local Clone = GUI:Clone()
    Clone.Parent = game.Players:FindFirstChild(Tool.Parent.Name):FindFirstChild("PlayerGui")
    Clone.Position = Udim2.new(math.random(0,0.80),0,math.random(0,0.80))
    print("Success!")
    wait(2)
    Clone:Destroy()
end

It might not work, but it should give you a head start!

Ad
Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

It didn't work i got it to work but it stiill show`s only 1

Tryed to change the folder Name too but doesn't change

Full Scriipt

local Tool = script.Parent
local GUI = game.Lighting.Animation:FindFirstChild("Hit")
math.randomseed(tick())
local rng = math.random()
local newfolder = "Hit" ..rng
local Text = GUI:FindFirstChild("TextLabel")
Text.Text = "+10"

Tool.Activated:Connect(function()

    wait(0.7)
    local Clone = GUI:Clone()
    Clone.Parent = game.Players:FindFirstChild(Tool.Parent.Name):FindFirstChild("PlayerGui")
    game.Players:FindFirstChild(Tool.Parent.Name):FindFirstChild("PlayerGui").Hit.Name = newfolder
    Clone.Parent:FindFirstChild(newfolder).TextLabel:TweenPosition(UDim2.new(0.625, 0,0.605, 0),"Out","Quint",1,true)
    print("Success!")
    wait(3)
    Clone.Parent:FindFirstChild(newfolder):Destroy()
end)

EDIT

I wan't to make something like this

https://www.youtube.com/watch?v=nPcuVxWzsvo

My looks like this

https://www.youtube.com/watch?v=cUYYMKGzqPc&

Like you see just 1 pops

Log in to vote
0
Answered by
BashGuy10 384 Moderation Voter
4 years ago

Very simple fix, your local newfolder = "Hit" ..rng is outside of the Tool.Activated function.

Just move it to the top of the function.

Mark this as the answer if it worked!

0
It worked before but the problem is that i wan't a guy showing the + every time i use my tool but i get only 1 and the next one if the first one is destroyed Ravage1337 35 — 4y
0
is there a possibility to show the same gui(+10 TextLabel) more then 1 time or do i have to change the name ? Ravage1337 35 — 4y

Answer this question