i tried this and everything seems ok but nothing works?
local Players = game:GetService("Players") local player = Players.LocalPlayer local MarketplaceService = game:GetService("MarketplaceService") script.Parent.Touched:Connect(function(h) local hum = h.Parent:FindFirstChild("Humanoid") if hum ~= nil then if player.MembershipType == Enum.MembershipType.Premium then script.Parent.CanCollide = false wait(0.1) script.Parent.CanCollide = true else -- prompt premium purchase MarketplaceService:PromptPremiumPurchase(player) h.Parent.HumanoidRootPart.CFrame = CFrame.new(script.Parent["TeleportPart"].Position) end end end)
Since this isn't a LocalScript, Players.LocalPlayer won't work, as this method only works in a LocalScript. (If this is a LocalScript, the script won't run at all if it's in Workspace)
To find the player, you can use Players:GetPlayerFromCharacter()
Example:
script.Parent.Touched:Connect(function(part) local humanoid = part.Parent:FindFirstChild("Humanoid") if (humanoid ~= nil) then player = game:GetService("Players"):GetPlayerFromCharacter(humanoid.Parent) end end)