Hello fellow Developers! I have a script in a game and I need help fixing it. The script is to pick a random image and there is a BillboardGui with a TextLabel inside of it and the TextLabel show the Food that you need to cook. Lastly, how do I get the play without using script.Parent.Touch:GetPlayerFromCharacter()? I just need to get it from a regular script. Here is my work:
local IDTable = {8069177903, 7086961634, 474674090, 13278495181}
local billboardGui = script.Parent.Parent.Parent.Parent.Bpart:WaitForChild(‘BillboardGui’)
local foodTextLabel = billboardGui.TextLabel
while wait(0.1) do
local randomIDTable = IDTable[math.random(1, #IDTable)]
local FoodTable = {game.ReplicatedStorage.Hamburger, game.ReplicatedStorage.Taco, game.ReplicatedStorage.Pizza}
script.Parent.Parent.Parent.ProximityPrompt.Triggered:Connect(function()
local randomFood = FoodTable[math.random(1, #FoodTable)]
foodTextLabel.Text = randomFood.Name
script.Parent.Image = randomIDTable
local player = -- how do I find the player with a script? Without script.Parent.Touch:GetPlayerFromCharacter(). Just need a way to get it with out touching something
end)
end