#Hi i need help with this script
1 messages · Page 1 of 1 (latest)
DM
say the problem?
Function module
FUNCTIONS MODULE == >
local Module = {}
local ClickEffect = game.ReplicatedStorage:FindFirstChild("ClickEffect")
local ts = game:GetService("TweenService")
local size = UDim2.new({0, 62},{0, 52})
local tInfo = TweenInfo.new(0.3, Enum.EasingStyle.Quad, Enum.EasingDirection.In, 0, false)
function Module.CloneEffectAtLocation (mouseLocation: UDim2, newParent: ScreenGui)
local CEFFECT = ClickEffect:Clone()
CEFFECT.Position = mouseLocation
CEFFECT.Parent = game.StarterGui.UserInterfaceEffects
local newParent = CEFFECT.Parent
if CEFFECT.AncestryChanged and newParent:IsA("ScreenGui") then
local tween = ts:Create(CEFFECT, tInfo, size)
tween:Play()
if tween.Completed then
CEFFECT:Destroy()
end
else
print(CEFFECT.Parent and newParent)
end
end
return Module
**GUI HANDLER ==> **
local uis = game:GetService("UserInputService")
local mousePos = uis:GetMouseLocation()
local mouse = game.Players.LocalPlayer:GetMouse()
local Functions = require(script.Function)
mouse.Button1Down:Connect(Functions.CloneEffectAtLocation(UDim2.new(0, mousePos.X, 0, mousePos.Y),
game.StarterGui.UserInterfaceEffects))
Got this error:
10:39:22.726 Unable to cast to Dictionary - Client - Function:16
kinda eyeballed this script
i also tried using a spawn function in the local script inside of the clickeffect so that when the ancestry changed it would tween and destroy at the players mouse location
however since the new parent is different than the defined script.Parent i wasnt really sure how to change the properties if i dont have the object defined resulting in a image label that didnt destroy
Uh
i think size udim2 is supposed to be UDim2.new(Xs, Xo, Ys, Yo)
The third parameter when you create a tween service is a table
No?
Instead of putting size, put {Size = size}
@shell agate yes udim2 needs x scale, x offset, y scale, y offset
Ye @shell agate change size to : UDim2.new(0,62,0,52)
And then when you create tween dont put size variable put {Size = size}
Solved ✅?