Hey, im currently making a roblox booth system which people can change their booths by pressing on a button, everything seems to be working properly except for getting the booth’s position from a script to another. when i try to, im getting this error:
these are my scripts:
server script which is located in all of the booths:
script.Parent.ProximityPrompt.Triggered:Connect(function(player)
local boothOwner = script.Parent.Parent.Owner
if boothOwner.Value == "Noone" or boothOwner.Value == player.Name then
if not player:FindFirstChild("OwnsBooth") then
script.Parent.Parent.Owner.Value = player.Name
script.Parent.Parent.Base.SurfaceGui.TextLabel.Text = "Owned By: " .. player.Name
script.Parent.ProximityPrompt.ActionText = "Edit Booth"
local tag = Instance.new("BoolValue")
tag.Name = "OwnsBooth"
tag.Parent = player
if boothOwner.Value == player.Name then
local boothName = "Booth1" -- Replace "Booth1" with the appropriate booth name
local boothPosition = script.Parent.Parent.Select.Position
print("Booth position:", boothPosition)
print("Select object:", script.Parent.Parent.Select)
game.ReplicatedStorage.ChangeBooth:FireClient(player, boothName, boothPosition)
end
end
game.ReplicatedStorage.BoothTextGui:FireClient(player)
else
warn("You do not own this booth.")
end
end)
server script in serverscriptservice:
game.ReplicatedStorage.ChangeBooth.OnServerEvent:Connect(function(player, boothName, boothPosition)
print("Received change booth request from:", player.Name)
print("Booth name:", boothName)
print("Booth position:", boothPosition)
local boothTemplate = game.ReplicatedStorage.Booths:FindFirstChild(boothName)
if boothTemplate then
print("Booth template found:", boothName)
local newBooth = boothTemplate:Clone()
newBooth.Parent = game.Workspace.Booths
newBooth.Owner.Value = player.Name
newBooth.Position = boothPosition -- Set the position of the new booth
else
warn("Booth template not found in the ReplicatedStorage.")
end
end)
its getting the actual position properly aswell, i can confirm that from the prints
it used to be, i just realised how that couldnt work since the booth in the replicatedstorage was a simple part for testing purposes so i changed it back to a model, but now i’m wondering how i can get the model’s position, any ideas? I tried making it by getting the position directly, but im getting this error:
this is my scripts:
script in every booths:
script.Parent.ProximityPrompt.Triggered:Connect(function(player)
local boothOwner = script.Parent.Parent.Owner
if boothOwner.Value == "Noone" or boothOwner.Value == player.Name then
if not player:FindFirstChild("OwnsBooth") then
script.Parent.Parent.Owner.Value = player.Name
script.Parent.Parent.Base.SurfaceGui.TextLabel.Text = "Owned By: " .. player.Name
script.Parent.ProximityPrompt.ActionText = "Edit Booth"
local tag = Instance.new("BoolValue")
tag.Name = "OwnsBooth"
tag.Parent = player
if boothOwner.Value == player.Name then
local boothName = "Booth1" -- Replace "Booth1" with the appropriate booth name
local boothPosition = script.Parent.Parent.Parent.Booth1.Position
print("Booth position:", boothPosition)
print("Select object:", script.Parent.Parent.Parent.Booth1)
game.ReplicatedStorage.ChangeBooth:FireClient(player, boothName, boothPosition)
end
end
game.ReplicatedStorage.BoothTextGui:FireClient(player)
else
warn("You do not own this booth.")
end
end)
script in serverscriptservice:
game.ReplicatedStorage.ChangeBooth.OnServerEvent:Connect(function(player, boothName, boothPosition)
print("Received change booth request from:", player.Name)
print("Booth name:", boothName)
print("Booth position:", boothPosition)
local boothTemplate = game.ReplicatedStorage.Booths:FindFirstChild(boothName)
if boothTemplate then
print("Booth template found:", boothName)
local newBooth = boothTemplate:Clone()
newBooth.Parent = game.Workspace.Booths
newBooth.Owner.Value = player.Name
newBooth.Position = boothPosition -- Set the position of the new booth
else
warn("Booth template not found in the ReplicatedStorage.")
end
end)
You should make one of the parts, preferably the part that displays stand info the PrimaryPart of the model. Then instead of setting the position, you should set the PrimaryPart’s CFrame so it moves the whole model.
You could also use PivotTo and not have to do the stuff above but it’s your choice