I have a script where if you click any part of the model, a GUI would appear asking to buy it, it, when yes is clicked the image they want to upload goes on the surface of the part, (already scripted). The problem is the GUI appears but you cannot upload any decal ID, nor does the TextLabel get updated. It also works for every single part, the GUI should only appear when you click the one you own. What may the issue be?
LocalScript:
local decalparts = workspace.DecalParts
local player = game.Players.LocalPlayer
local EP = player:FindFirstChild("leaderstats1")
local points = EP:FindFirstChild("ElitePoints")
local Owns = script.Parent.Frame.Owns
local guiFrame = script.Parent.Frame
local Frame = script.Parent.Decal
local yes = script.Parent.Frame.Yes
for _, part in next, decalparts:GetChildren() do
part.ClickDetector.MouseClick:Connect(function()
guiFrame.Visible = true
if Owns.Value then
Frame.Visible = true
guiFrame.Visible = false
end
local decal = part.Decal
local event = game:GetService("ReplicatedStorage"):WaitForChild("imagedec")
local text = script.Parent.Decal.imageid
script.Parent.Decal.imageupload.MouseButton1Down:Connect(function()
local textid = text.Text
event:FireServer(textid)
end)
end)
end
yes.MouseButton1Down:Connect(function()
if points and points.Value >= 10
then
points.Value = points.Value - 10
Owns.Value = true
script.Parent.Frame.Visible = false
part.SurfaceGui.TextLabel.Text = player.Name .. "'s Decal"
end
end)