LocalScript

local Frame = script.Parent:WaitForChild("Frame")
local Confirm = Frame:WaitForChild("Confirm")
local Decline = Frame:WaitForChild("Decline")
local Image1 = Frame:WaitForChild("ItemImage")
local Description1 = Frame:WaitForChild("Description")
local Info = Frame:WaitForChild("Info")
local item
local price
local image
local description
game.ReplicatedStorage.PurchaseItem:FireClient(item)
Frame.Visible = true
Info.Text = "Are you sure you would like to purchase "..item.."for $"..price
Description1.Text = description
Image1.Image = image
end)

ServerScript

function onTouched(hit)
print("touched by" ..hit.Parent.Name)--make sure it detects correctly
if not hit then return end
if not hit.Parent then return end
if hit.Name == "Part" then
local item = hit.Parent
local price = item.Price.Value
local image = item.Image.Value
local description = item.Description.Value
local itemtype = item.Type.Value
game.ReplicatedStorage.PurchaseItem:FireClient(item,price,image,description,itemtype)
end
end
script.Parent.Touched:connect(onTouched)

7 comments

0

You can post code in code-format here. The format in which you posted your code is nearly unreadable.

0

is that better?

0

On the local script, is that the entire script?

0

theres 2 different scripts the local and server

0

Yes, but in the local script you have a "end)" showing it's ending a function or something...

0

its because i originally had game.ReplicatedStorage.PurchaseItem.OnClientEvent:Connect(function(Player,item,price,description,image)

0

You have to fire to the client with the player parameter first in the server script.