plz someone tell me what im doing wrong i spent all day on this
This is the vipdoorscript:
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local MarketplaceService = game:GetService("MarketplaceService")
local VIPGamePassID = 1306358295 --
local remote = ReplicatedStorage:WaitForChild("VIPDoorRE")
local door = workspace:WaitForChild("VIPDoor")
remote.OnServerEvent:Connect(function(player)
local success, ownsPass = pcall(function()
return MarketplaceService:UserOwnsGamePassAsync(player.UserId, VIPGamePassID)
end)
if success and ownsPass then
print(player.Name .. " is a VIP! Opening the door...")
-- Open the door
door.Transparency = 0.5
door.CanCollide = false
-- Optional: Reset after 5 seconds
task.delay(5, function()
door.Transparency = 0
door.CanCollide = true
end)
else
print(player.Name .. " tried to open the VIP door but isn't a VIP.")
-- Optionally notify the player (e.g., via GUI or sound)
end
end)
Then the localserver script
local Player = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
ReplicatedStorage.VIPdoorRe.OnClientEvent:Connect(function(sanitycheck))
if sanitycheck == "UnlockDoor" then
game.Workspace.vipdoor.CanCollide = false
end
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local player = Players.LocalPlayer
local remote = ReplicatedStorage:WaitForChild("VIPDoorRE")
local vipDoor = workspace:WaitForChild("VIPDoor")
local prompt = vipDoor:WaitForChild("VIPPrompt")
prompt.TriggerEnded:Connect(function(triggeringPlayer)
-- Make sure the local player is the one triggering it
if triggeringPlayer == player then
remote:FireServer()
end
end)