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 :)
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!
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
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!