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

Physical object wont update with script?

Asked by 2 years ago
Edited 2 years ago

Im trying to make a booth game and when you update the booth for some reason the price stays at 0

PS : the text on the booth (called MainText in the scripts) does update.

LocalScript (for the confirm button)


script.Parent.MouseButton1Click:Connect(function() local Price = tostring(script.Parent.Parent.Price.Value) local MainText = script.Parent.Parent.MainText.Value local ItemToSell = script.Parent.Parent.ItemToSell.Item.Value local PlayersItems = game.Players.LocalPlayer.Backpack:GetChildren() game.ReplicatedStorage.ChangeBooth:FireServer(Price, MainText, ItemToSell) for i, v in pairs(PlayersItems) do if v.Name == ItemToSell then v:Destroy() end end end)

ServerScript (event reciever)

local ReplicatedStorage = game:GetService("ReplicatedStorage")

ReplicatedStorage.ChangeBooth.OnServerEvent:Connect(function(player, Price, Text, ItemName)
    local CheckForBooth = game.Workspace:GetChildren()

    for i, v in pairs(CheckForBooth) do
        if v.Name == player.Name.."'s Booth" then
            v.CustomText.SurfaceGui.TextLabel.Text = Text
            v.PurchaseButton.SurfaceGui.TextLabel.Text = "Buy for "..Price.." dabloons"
            v.ItemName.Value = ItemName
        end
    end
end)

Answer this question